Commit a2d76290 authored by Steven Rostedt (Red Hat)'s avatar Steven Rostedt (Red Hat) Committed by Steven Rostedt

tracing: Have stack tracer force RCU to be watching

The stack tracer was triggering the WARN_ON() in module.c:

 static void module_assert_mutex_or_preempt(void)
	if (unlikely(!debug_locks))

	WARN_ON(!rcu_read_lock_sched_held() &&

The reason is that the stack tracer traces all function calls, and some of
those calls happen while exiting or entering user space and idle. Some of
these functions are called after RCU had already stopped watching, as RCU
does not watch userspace or idle CPUs.

If a max stack is hit, then the save_stack_trace() is called, which will
check module addresses and call module_assert_mutex_or_preempt(), and then
trigger the warning. Sad part is, the warning itself will also do a stack
trace and tigger the same warning. That probably should be fixed.

The warning was added by 0be964be "module: Sanitize RCU usage and
locking" but this bug has probably been around longer. But it's unlikely to
cause much harm, but the new warning causes the system to lock up.

Cc: # 4.2+
Cc: Peter Zijlstra <>
Cc:"Paul E. McKenney" <>
Signed-off-by: default avatarSteven Rostedt <>
parent 7379047d
......@@ -88,6 +88,12 @@ check_stack(unsigned long ip, unsigned long *stack)
* RCU may not be watching, make it see us.
* The stack trace code uses rcu_sched.
/* In case another CPU set the tracer_frame on us */
if (unlikely(!frame_size))
this_size -= tracer_frame;
......@@ -169,6 +175,7 @@ check_stack(unsigned long ip, unsigned long *stack)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment