All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,david@kernel.org,baoquan.he@linux.dev,
	urezki@gmail.com,akpm@linux-foundation.org
Subject: + mm-vmalloc-bail-out-if-in-softirq-context.patch added to mm-hotfixes-unstable branch
Date: Tue, 01 Dec 2026 10:21:35 -0800	[thread overview]
Message-ID: <20261201182135.E51D71F00925@smtp.kernel.org> (raw)
In-Reply-To: <20261201173727.90526-1-urezki@gmail.com>


The patch titled
     Subject: mm/vmalloc: bail out if in softirq context
has been added to the -mm mm-hotfixes-unstable branch.  Its filename is
     mm-vmalloc-bail-out-if-in-softirq-context.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-vmalloc-bail-out-if-in-softirq-context.patch

This patch will later appear in the mm-hotfixes-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
Subject: mm/vmalloc: bail out if in softirq context
Date: Tue,  1 Dec 2026 18:37:27 +0100

vmalloc() is not allowed to be invoked from the NMI, hard-irq and softirq
contexts because doing so may deadlock on internal locks.

Commit 04aa71da5f35 ("mm/vmalloc: do not trigger BUG() on BH disabled
context") replaced the deprecated in_interrupt() macro with explicit
in_nmi() and in_hardirq() checks, but unintentionally dropped the softirq
context check.

Example:

<snip>
vzalloc() in a task
 spin_lock(&vn->busy.lock)
  <------ Hard irq
   irq_exit()
    process softirq on the same CPU
     vmalloc()
      spin_lock(&vn->busy.lock)
       spins forever
<snip>

Restore the original context restriction including BH-disabled task
context.

Use WARN_ON_ONCE() and return NULL instead of BUG_ON(), so invalid callers
are reported without triggering a BUG.

Link: https://patch.msgid.link/20261201173727.90526-1-urezki@gmail.com
Fixes: 04aa71da5f35 ("mm/vmalloc: do not trigger BUG() on BH disabled context")
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand (Arm) <david@kernel.org>
Cc: Baoquan He <baoquan.he@linux.dev>

 mm/vmalloc.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/mm/vmalloc.c~mm-vmalloc-bail-out-if-in-softirq-context
+++ a/mm/vmalloc.c
@@ -3266,7 +3266,12 @@ struct vm_struct *__get_vm_area_node(uns
 	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;
+
 	size = ALIGN(size, 1ul << shift);
 	if (unlikely(!size))
 		return NULL;
_

Patches currently in -mm which might be from urezki@gmail.com are

mm-vmalloc-use-dedicated-unbound-workqueues-for-vmap-drain.patch
mm-vmalloc-bail-out-if-in-softirq-context.patch


  reply	other threads:[~2026-12-01 18:21 UTC|newest]

Thread overview: 4+ 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-01 18:21 ` Andrew Morton [this message]
2026-12-02  2:31 ` Baoquan He
  -- strict thread matches above, loose matches on Subject: below --
2026-11-09 17:32 + mm-vmalloc-bail-out-if-in-softirq-context.patch added to mm-hotfixes-unstable branch Andrew Morton

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=20261201182135.E51D71F00925@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=baoquan.he@linux.dev \
    --cc=david@kernel.org \
    --cc=mm-commits@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.