linux/kernel/trace
Steven Rostedt 301fd748e2 tracing: remove CALLER_ADDR2 from wakeup tracer
Maneesh Soni was getting a crash when running the wakeup tracer.
We debugged it down to the recording of the function with the
CALLER_ADDR2 macro.  This is used to get the location of the caller
to schedule.

But the problem comes when schedule is called by assmebly. In the case
that Maneesh had, retint_careful would call schedule. But retint_careful
does not set up a proper frame pointer. CALLER_ADDR2 is defined as
__builtin_return_address(2). This produces the following assembly in
the wakeup tracer code.

   mov    0x0(%rbp),%rcx  <--- get the frame pointer of the caller
   mov    %r14d,%r8d
   mov    0xf2de8e(%rip),%rdi

   mov    0x8(%rcx),%rsi  <-- this is __builtin_return_address(1)
   mov    0x28(%rdi,%rax,8),%rbx

   mov    (%rcx),%rax  <-- get the frame pointer of the caller's caller
   mov    %r12,%rcx
   mov    0x8(%rax),%rdx <-- this is __builtin_return_address(2)

At the reading of 0x8(%rax) Maneesh's machine would take a fault.
The reason is that retint_careful did not set up the return address
and the content of %rax here was zero.

To verify this, I sent Maneesh a patch to create a frame pointer
in retint_careful. He ran the test again but this time he would take
the same type of fault from sysret_careful. The retint_careful was no
longer an issue, but there are other callers that still have issues.

Instead of adding frame pointers for all callers to schedule (in possibly
all archs), it is much safer to simply not use CALLER_ADDR2. This
loses out on knowing what called schedule, but the function tracer
will help there if needed.

Reported-by: Maneesh Soni <maneesh@in.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-04-07 13:58:54 +02:00
..
Kconfig tracing: Fix TRACING_SUPPORT dependency for PPC32 2009-03-23 23:23:03 +01:00
Makefile tracing: add per-event filtering 2009-03-22 18:38:46 +01:00
blktrace.c blktrace: fix pdu_len when tracing packet command requests 2009-04-03 15:29:26 +02:00
events.c ftrace: event profile hooks 2009-03-20 10:17:07 +01:00
ftrace.c ftrace: Using FTRACE_WARN_ON() to check "freed record" in ftrace_release() 2009-03-25 17:45:36 -04:00
kmemtrace.c tracing: Introduce trace_buffer_{lock_reserve,unlock_commit} 2009-02-06 01:01:41 +01:00
ring_buffer.c Merge branches 'tracing/docs', 'tracing/filters', 'tracing/ftrace', 'tracing/kprobes', 'tracing/blktrace-v2' and 'tracing/textedit' into tracing/core-v2 2009-03-31 17:46:40 +02:00
trace.c Merge branches 'tracing/docs', 'tracing/filters', 'tracing/ftrace', 'tracing/kprobes', 'tracing/blktrace-v2' and 'tracing/textedit' into tracing/core-v2 2009-03-31 17:46:40 +02:00
trace.h Merge branches 'tracing/docs', 'tracing/filters', 'tracing/ftrace', 'tracing/kprobes', 'tracing/blktrace-v2' and 'tracing/textedit' into tracing/core-v2 2009-03-31 17:46:40 +02:00
trace_boot.c tracing: Introduce trace_buffer_{lock_reserve,unlock_commit} 2009-02-06 01:01:41 +01:00
trace_branch.c tracing: remove funky whitespace in the trace code 2009-03-10 14:13:14 -04:00
trace_clock.c tracing: fix four sparse warnings 2009-03-22 18:16:54 +01:00
trace_event_profile.c ftrace: event profile hooks 2009-03-20 10:17:07 +01:00
trace_event_types.h tracing: remove recording function depth from trace_printk 2009-03-19 15:58:47 -04:00
trace_events.c tracing: filter fix for TRACE_EVENT_FORMAT events 2009-03-26 09:13:14 +01:00
trace_events_filter.c tracing/filters: disallow integer values for string filters and vice versa 2009-03-24 08:26:52 +01:00
trace_events_stage_1.h tracing: update comments to match event code macros 2009-03-10 13:12:58 -04:00
trace_events_stage_2.h tracing: add run-time field descriptions for event filtering 2009-03-22 18:11:22 +01:00
trace_events_stage_3.h tracing/events: don't discard an event after commit 2009-03-23 09:22:15 +01:00
trace_export.c tracing: remove funky whitespace in the trace code 2009-03-10 14:13:14 -04:00
trace_functions.c tracing/core: use appropriate waiting on trace_pipe 2009-02-18 01:40:20 +01:00
trace_functions_graph.c function-graph: moved the timestamp from arch to generic code 2009-03-24 09:31:34 -04:00
trace_hw_branches.c tracing/hw-branch-tracing: convert bts-tracer mutex to a spinlock 2009-02-25 09:16:01 +01:00
trace_irqsoff.c tracing: have latency tracers set the latency format 2009-03-04 22:15:30 -05:00
trace_mmiotrace.c tracing: remove recording function depth from trace_printk 2009-03-19 15:58:47 -04:00
trace_nop.c tracing/ftrace: make nop-tracer use polling wait for events on pipe 2009-03-23 09:22:15 +01:00
trace_output.c trace: make argument 'mem' of trace_seq_putmem() const 2009-03-31 17:45:13 +02:00
trace_output.h trace: make argument 'mem' of trace_seq_putmem() const 2009-03-31 17:45:13 +02:00
trace_power.c tracing: make power tracer start/stop methods lighter weight 2009-03-17 23:12:11 -04:00
trace_printk.c tracing: remove recording function depth from trace_printk 2009-03-19 15:58:47 -04:00
trace_sched_switch.c tracing: make sched_switch stop/start light weight 2009-03-17 23:10:45 -04:00
trace_sched_wakeup.c tracing: remove CALLER_ADDR2 from wakeup tracer 2009-04-07 13:58:54 +02:00
trace_selftest.c tracing: keep the tracing buffer after self-test failure 2009-03-22 15:17:21 +01:00
trace_selftest_dynamic.c ftrace: fix dynamic ftrace selftest 2008-05-23 21:13:23 +02:00
trace_stack.c tracing: left align location header in stack_trace 2009-03-13 00:00:58 -04:00
trace_stat.c trace_stat: keep original order 2009-03-25 18:32:34 +01:00
trace_stat.h tracing/ftrace: separate events tracing and stats tracing engine 2009-01-14 12:11:37 +01:00
trace_syscalls.c tracing/syscalls: protect thread flag toggling from races 2009-03-16 09:13:16 +01:00
trace_sysprof.c tracing: make all file_operations const 2009-03-05 21:46:40 -05:00
trace_workqueue.c trace_workqueues: fix empty line's output 2009-03-25 18:32:35 +01:00