Re: [PATCH] genirq/core: Fall back to a static default affinity mask
From: Thomas Gleixner
Date: Mon Nov 02 2026 - 18:34:06 EST
On Sat, Oct 31 2026 at 15:38, Avi Weiss wrote:
> With CONFIG_CPUMASK_OFFSTACK=y, init_irq_default_affinity() does not
> check whether zalloc_cpumask_var() succeeds. If the GFP_NOWAIT allocation
> fails, cpumask_empty() dereferences a NULL mask during early boot.
>
> Use a private static cpumask when allocation fails, keeping the default
> IRQ affinity mask available and writable.
>
> In a QEMU guest, a test-only allocation failure triggered the boot fault
> without this change. The patched kernel booted with the same injected
> failure and allowed the default affinity mask to be read and written.
> Normal and irqaffinity=0 boots also passed.
If that allocation fails the kernel won't boot at all.
Aside of that the fallback mask defeats the whole purpose of allocating
the mask at runtime.
I'm all for defensive programming, but this is just trying to "fix" a
problem which does not exist to begin with.
If you really want to do something when that allocation theoretically
fails then panic the machine because it is going to die on the next
allocation anyway.
Thanks,
tglx