Running tests on other changes, the system locked up due to lots

of warnings. It was caused by the stack tracer triggering a warning
 about using rcu_dereference() when RCU was not watching. This can happen
 due to the fact that the stack tracer uses the function tracer to check
 each function, and there's functions that may be called and traced
 when RCU stopped watching. Namely when a function is called just before
 going idle or to userspace and after RCU stopped watching that current
 CPU.
 
 The first patch makes sure that RCU is watching when the stack tracer
 uses RCU. The second patch is to make sure that the stack tracer does
 not get called by functions in NMI, as it's not NMI safe.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJWKOJaAAoJEEjnJuOKh9ldQsIH/RljIDrkq/RRr22TQZIFafrY
 q9ZwWrEOiVetdANhN1SUJEnEHHDw/17c77r2bLcBvb1L97sRU+1PF5mATkYy7dUL
 4B9/3kOydMwU9boDe7ObsjUO2YH51eMCUR15dPYvxqb5w3EZQXMucZnT93nHVPZZ
 0OTEzIZmNczfJTnmzdMWggmE9Wgdj0LXLMi+H+OqDfAw2YnyqvvehdipePiyCxVj
 9XPVuv0fbjFbCgzTi50NPD9xXCPgLDxowsh0Hoym0DGdvDPj21EuI4l6DWwOIe+D
 KKm2X1y7b10hnBVnHeMjugaf8W4sztW7WitgujnUucscEVUy0lp72y0m+kNLRhc=
 =L+k7
 -----END PGP SIGNATURE-----

Merge tag 'trace-fixes-v4.3-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull tracing fixes from Steven Rostedt:
 "Running tests on other changes, the system locked up due to lots of
  warnings.  It was caused by the stack tracer triggering a warning
  about using rcu_dereference() when RCU was not watching.  This can
  happen due to the fact that the stack tracer uses the function tracer
  to check each function, and there are functions that may be called and
  traced when RCU stopped watching.  Namely when a function is called
  just before going idle or to userspace and after RCU stopped watching
  that current CPU.

  The first patch makes sure that RCU is watching when the stack tracer
  uses RCU.  The second patch is to make sure that the stack tracer does
  not get called by functions in NMI, as it's not NMI safe"

* tag 'trace-fixes-v4.3-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  tracing: Do not allow stack_tracer to record stack in NMI
  tracing: Have stack tracer force RCU to be watching
This commit is contained in:
Linus Torvalds 2015-10-23 18:24:33 +09:00
commit 8a990fb47b

View File

@ -85,9 +85,19 @@ check_stack(unsigned long ip, unsigned long *stack)
if (!object_is_on_stack(stack))
return;
/* Can't do this from NMI context (can cause deadlocks) */
if (in_nmi())
return;
local_irq_save(flags);
arch_spin_lock(&max_stack_lock);
/*
* RCU may not be watching, make it see us.
* The stack trace code uses rcu_sched.
*/
rcu_irq_enter();
/* In case another CPU set the tracer_frame on us */
if (unlikely(!frame_size))
this_size -= tracer_frame;
@ -169,6 +179,7 @@ check_stack(unsigned long ip, unsigned long *stack)
}
out:
rcu_irq_exit();
arch_spin_unlock(&max_stack_lock);
local_irq_restore(flags);
}