[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <69789f7f.050a0220.c9109.0019.GAE@google.com>
Date: Tue, 27 Jan 2026 03:20:31 -0800
From: syzbot <syzbot+316c0070a0341d2661a2@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com
Subject: Forwarded: [PATCH] x86/stacktrace: Prevent RCU stalls during deep
stack unwinding
For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com.
***
Subject: [PATCH] x86/stacktrace: Prevent RCU stalls during deep stack unwinding
Author: kartikey406@...il.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@...kaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=316c0070a0341d2661a2
Signed-off-by: Deepanshu Kartikey <kartikey406@...il.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
Powered by blists - more mailing lists