Re: [PATCH] xen/grant-table: fix resource leak in gnttab_init()
From: Edgecombe, Rick P
Date: Fri Nov 20 2026 - 17:07:15 EST
On Fri, 2026-11-20 at 13:56 +0800, Haoxiang Li wrote:
>
> At 2026-11-20 07:18:03, "Edgecombe, Rick P" <rick.p.edgecombe@xxxxxxxxx> wrote:
> >
> > If the PV guest hits this scenario can it survive? I don't know xen pv very
> > well. Does this means that the PV guest has no disk or network. If so, the user
> > is probably not concerned with a one time memory leak.
>
> Thanks for raising this. I tested an x86-64 PV Dom0 under Xen 4.17.7 in QEMU,
> using ata_piix for storage and e1000 for networking.
Ah ok, in dom0. (not xen person here)
>
> I injected -ENOMEM immediately before the initial MFN-array allocation in
> gnttab_map(), after arch_gnttab_init() had succeeded. With and without the
> patch, gnttab_init() returned -ENODEV, but Dom0 still booted to userspace.
> In both cases, disk I/O worked, and the network interface could reach the
> QEMU gateway.
>
> However, I agree that this is a one-time leak with limited impact. I have not
> demonstrated any further user-visible consequences from the leak.
Not that it's impossible, but at boot we could expect allocations to be less
likely to fail.
I guess since you injected the error you didn't hit this in practice? If so, I'd
think this would be a pretty low priority fix. The combo of rare scenario and
close to zero user impact. Fine to be corrected though.