From: sashiko-bot@kernel.org
To: "Uladzislau Rezki (Sony)" <urezki@gmail.com>,
linux-mm@kvack.org, "Andrew Morton" <akpm@linux-foundation.org>
Cc: "Baoquan He" <baoquan.he@linux.dev>,
"David Hildenbrand (Arm)" <david@kernel.org>
Subject: Re: [PATCH v2] mm/vmalloc: Bail out if in softirq context
Date: Wed, 02 Dec 2026 17:37:45 +0000 [thread overview]
Message-ID: <sashiko-outbox-246347@kernel.org> (raw)
In-Reply-To: <20261201173727.90526-1-urezki@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mm/vmalloc: WARN_ON_ONCE in __get_vm_area_node() on atomic
kvmalloc()
--
commit b5a4024f17bff0a7c18243c940b773dd42c4d2f1
Author: Uladzislau Rezki (Sony) <urezki@gmail.com>
mm/vmalloc: Bail out if in softirq context
This commit replaces the BUG_ON(in_nmi() || in_hardirq()) check in
__get_vm_area_node() with a WARN_ON_ONCE() check that also rejects softirq
and BH-disabled contexts and returns NULL.
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index a4c22c569b1de..fe5bdb4fde52b 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -3258,7 +3258,12 @@ struct vm_struct *__get_vm_area_node(unsigned long size,
> struct vm_struct *area;
> unsigned long requested_size = size;
>
> - BUG_ON(in_nmi() || in_hardirq());
> + /*
> + * Reject interrupt contexts, including BH-disabled task context.
> + */
> + if (WARN_ON_ONCE(in_nmi() || in_hardirq() || softirq_count()))
> + return NULL;
[Severity: Medium]
Can this trigger a WARN_ON_ONCE() splat on valid atomic kvmalloc() calls in
softirq or BH-disabled context?
Since commit c6307674ed82 ("mm: kvmalloc: add non-blocking support for
vmalloc"), __kvmalloc_node_noprof() falls back to
__vmalloc_node_range_noprof() whenever a multi-page __do_kmalloc_node()
attempt fails, even for GFP_ATOMIC callers:
mm/slub.c:__kvmalloc_node_noprof() {
...
ret = __do_kmalloc_node(size, kmalloc_gfp_adjust(flags, size), node,
_RET_IP_);
if (ret || size <= PAGE_SIZE)
return ret;
...
return __vmalloc_node_range_noprof(size, align, VMALLOC_START, VMALLOC_END,
flags, PAGE_KERNEL, allow_block ? VM_ALLOW_HUGE_VMAP:0,
node, __builtin_return_address(0));
}
Callers such as br_fdb_add_local() (holding spin_lock_bh(&br->hash_lock))
and br_fdb_update() (in softirq) call rhashtable_lookup_insert_fast() ->
rhashtable_insert_rehash() -> bucket_table_alloc() with GFP_ATOMIC |
__GFP_NOWARN, expecting kvmalloc() to return NULL silently on failure so
bucket_table_alloc() can fall back to nested_bucket_table_alloc(). When the
initial kmalloc attempt fails, falling through to __get_vm_area_node() hits
this WARN_ON_ONCE() (and crashes systems with panic_on_warn enabled, such as
syzbot, on the same BH-disabled path that commit 04aa71da5f35 ("mm/vmalloc:
do not trigger BUG() on BH disabled context") addressed). If an atomic
caller does not pass __GFP_NOWARN, __vmalloc_node_range_noprof() also emits
a warn_alloc() splat when __get_vm_area_node() returns NULL because
kmalloc_gfp_adjust() only applies __GFP_NOWARN to __do_kmalloc_node().
Should __kvmalloc_node_noprof() avoid the vmalloc fallback when
in_interrupt() is true?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201173727.90526-1-urezki@gmail.com?part=1
prev parent reply other threads:[~2026-12-02 17:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 17:37 [PATCH v2] mm/vmalloc: Bail out if in softirq context Uladzislau Rezki (Sony)
2026-12-02 2:31 ` Baoquan He
2026-12-02 17:37 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-246347@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baoquan.he@linux.dev \
--cc=david@kernel.org \
--cc=linux-mm@kvack.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=urezki@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox