public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+316c0070a0341d2661a2@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: [PATCH] x86/stacktrace: Prevent RCU stalls during deep stack unwinding
Date: Tue, 27 Jan 2026 03:20:31 -0800	[thread overview]
Message-ID: <69789f7f.050a0220.c9109.0019.GAE@google.com> (raw)
In-Reply-To: <69780fd3.050a0220.c9109.000b.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: [PATCH] x86/stacktrace: Prevent RCU stalls during deep stack unwinding
Author: kartikey406@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master


When KASAN is enabled, stack unwinding for allocation tracking can
become expensive. Real-time tasks that perform many allocations
(e.g., VMA operations with maple tree preallocation) can monopolize
the CPU during deep stack traces, preventing the RCU grace period
kthread from running and causing RCU stalls.

Add periodic yielding during stack unwinding to allow other tasks,
particularly the RCU grace period kthread, to make progress. Yield
every 16 frames or when rescheduling is needed, similar to the
approach used in mm/vmalloc.c for KASAN operations.

Reported-by: syzbot+316c0070a0341d2661a2@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=316c0070a0341d2661a2
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
 arch/x86/kernel/stacktrace.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c
index ee117fcf46ed..b7d2912a715b 100644
--- a/arch/x86/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
@@ -17,6 +17,7 @@ void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
 {
 	struct unwind_state state;
 	unsigned long addr;
+	unsigned int frame_count = 0;
 
 	if (regs && !consume_entry(cookie, regs->ip))
 		return;
@@ -26,6 +27,12 @@ void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
 		addr = unwind_get_return_address(&state);
 		if (!addr || !consume_entry(cookie, addr))
 			break;
+
+		if (IS_ENABLED(CONFIG_KASAN) &&
+		    (need_resched() || ++frame_count >= 16)) {
+			cond_resched();
+			frame_count = 0;
+		}
 	}
 }
 
-- 
2.43.0


      reply	other threads:[~2026-01-27 11:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27  1:07 [syzbot] [bpf?] INFO: rcu detected stall in vma_merge_new_range (3) syzbot
2026-01-27 11:20 ` syzbot [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=69789f7f.050a0220.c9109.0019.GAE@google.com \
    --to=syzbot+316c0070a0341d2661a2@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.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