[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xen: fix memory leak on error in vcpu_create
- To: Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
- Date: Tue, 29 Jul 2025 17:08:43 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4VW+wjfXcQvbT20HvHNUkAoWTLEUJwffevIw3a8bgHE=; b=OQi9woBLDqHIc9VsR49dwUd/i8Iojm0Ntcwc8C3Fyadu3+EQL9xZarUZWQiNC8tIs60GXqtfrMqhETv5S8zWdMWcIttCcAr2pjKVA7eDLHiVflnmuC7S0hl3iPn44088hA7LJwHQ1Uo3FpF//AqjnG8N8lse1LSZnKl3fW7bSrGd8tINVfplRLXW33BRhG34D0ue6dvwPa1InFPUC1oVcAyBFcLNMqTGGFxQsE/QfvPNvWSiNzXdB/6sIPEbtZfaVbAqAXF/yCdZPaKilOtsNSqwMgi9LzyKxNS02Pe9pJQR24GCrlihMgY/+aljTN3hKqfoGubdsrmdlPUZCbfANw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EzKA1ji43edwF8nMlowquIb8lkJW/LJlYMYw7n1UBus7WkZ6afXowv+tcVTHPsZdsly4zgPCUAPnynlC6o4lf6QI1OoPqlNR3pZnnpvevwxZOMiC6yJj6NNpBSGAZHRbAg66o6FCyKLnbkQDAFA+GwxzF93PJvgt+PtSK43qwIGvaP0dstqWRYaKV4Oe1Br5t7HeLKARW5U23hVJjGvObJLrKAWX+xLOsLRxDVOq7YvTK3PbveZVH6KqYP5VMdNR9BIK6MyU4d+1sw08b7yXYxxvuLXmfIE0Afe93j34a+/6nKNY8UwXhW30Lp2QHWqW+4v2h/BxGYfxByoE4mXu6Q==
- Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Tue, 29 Jul 2025 21:09:05 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 7/29/25 04:32, Jan Beulich wrote:
> On 28.07.2025 22:09, Andrew Cooper wrote:
>> On 28/07/2025 8:52 pm, Stewart Hildebrand wrote:
>>> In vcpu_create after scheduler data is allocated, if
>>> vmtrace_alloc_buffer fails, it will jump to the wrong cleanup label
>>> resulting in a memory leak. Correct the label.
>>>
>>> Fixes: 217dd79ee292 ("xen/domain: Add vmtrace_size domain creation
>>> parameter")
>>> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
>>
>> Urgh, sorry for breaking this. Ultimately it comes from having two
>> different error handling schemes.
>>
>> This patch is probably ok to start with (and to backport), but a better
>> fix would be to handle sched and wq in vcpu_teardown(). That way we get
>> a single failure path that does the correct thing irrespective.
>
> I agree, and that variant would apparently be as easily backportable.
> Stewart, are you up for going that route?
Yep, I'll give it a try
>
> Jan
>
>> An unrelated observation, but there's a waitqueue vcpu allocated in the
>> common path, but I was under the impression that only x86 had any need
>> for wqv (and I still need to get around to fixing introspection so we
>> can drop wait.c entirely).
>>
>> ~Andrew
>
|