On Thu, Nov 05, 2026 at 06:37:49PM +0100, Uladzislau Rezki wrote: > > Probably the simplest option is to return NULL for non-blocking vmalloc() > allocations when BH are disabled. That would address the reported > rhashtable deadlock. OK let's try this patch: ---8<--- The function kvmalloc may call vmalloc under the hood even when used with GFP_ATOMIC. However, vmalloc uses naked spin locks so it must not be called if the caller already holds spin locks that can be used in hard or soft IRQ context. Use the heuristic irqs_disabled() || in_softirq() to detect such callers and prevent them from using vmalloc. Reported-by: Liam R. Howlett (Google) Fixes: c6307674ed82 ("mm: kvmalloc: add non-blocking support for vmalloc") Signed-off-by: Herbert Xu diff --git a/mm/slub.c b/mm/slub.c index 45e077c7526c..18bc70f44e22 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -7139,6 +7139,14 @@ void *__kvmalloc_node_noprof(DECL_KMALLOC_PARAMS(size, b, token), unsigned long if (ret || size <= PAGE_SIZE) return ret; + /* + * vmalloc uses naked spin locks, so it must not be used if + * the caller already holds a spin lock that can be used in + * a soft or hard IRQ. Use heuristics to detect this. + */ + if (irqs_disabled() || in_interrupt()) + return NULL; + /* Don't even allow crazy sizes */ if (unlikely(size > INT_MAX)) { WARN_ON_ONCE(!(flags & __GFP_NOWARN)); -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt