linux-stable/arch
AKASHI Takahiro 20380bb390 arm64: ftrace: fix a stack tracer's output under function graph tracer
Function graph tracer modifies a return address (LR) in a stack frame
to hook a function return. This will result in many useless entries
(return_to_handler) showing up in
 a) a stack tracer's output
 b) perf call graph (with perf record -g)
 c) dump_backtrace (at panic et al.)

For example, in case of a),
  $ echo function_graph > /sys/kernel/debug/tracing/current_tracer
  $ echo 1 > /proc/sys/kernel/stack_trace_enabled
  $ cat /sys/kernel/debug/tracing/stack_trace
        Depth    Size   Location    (54 entries)
        -----    ----   --------
  0)     4504      16   gic_raise_softirq+0x28/0x150
  1)     4488      80   smp_cross_call+0x38/0xb8
  2)     4408      48   return_to_handler+0x0/0x40
  3)     4360      32   return_to_handler+0x0/0x40
  ...

In case of b),
  $ echo function_graph > /sys/kernel/debug/tracing/current_tracer
  $ perf record -e mem:XXX:x -ag -- sleep 10
  $ perf report
                  ...
                  |          |          |--0.22%-- 0x550f8
                  |          |          |          0x10888
                  |          |          |          el0_svc_naked
                  |          |          |          sys_openat
                  |          |          |          return_to_handler
                  |          |          |          return_to_handler
                  ...

In case of c),
  $ echo function_graph > /sys/kernel/debug/tracing/current_tracer
  $ echo c > /proc/sysrq-trigger
  ...
  Call trace:
  [<ffffffc00044d3ac>] sysrq_handle_crash+0x24/0x30
  [<ffffffc000092250>] return_to_handler+0x0/0x40
  [<ffffffc000092250>] return_to_handler+0x0/0x40
  ...

This patch replaces such entries with real addresses preserved in
current->ret_stack[] at unwind_frame(). This way, we can cover all
the cases.

Reviewed-by: Jungseok Lee <jungseoklee85@gmail.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
[will: fixed minor context changes conflicting with irq stack bits]
Signed-off-by: Will Deacon <will.deacon@arm.com>
2015-12-21 17:26:02 +00:00
..
alpha
arc ARC: dw2 unwind: Remove falllback linear search thru FDE entries 2015-11-23 21:36:49 +05:30
arm RTC fixes for 4.4 2015-11-29 17:30:41 -08:00
arm64 arm64: ftrace: fix a stack tracer's output under function graph tracer 2015-12-21 17:26:02 +00:00
avr32
blackfin
c6x
cris
frv
h8300 h8300 update for v4.4 2015-11-12 15:26:39 -08:00
hexagon
ia64
m32r
m68k m68k: Wire up mlock2 2015-11-22 11:35:26 +01:00
metag
microblaze
mips Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-11-29 17:24:35 -08:00
mn10300
nios2 nios2: fix cache coherency 2015-11-26 22:25:58 +08:00
openrisc
parisc Merge branch 'parisc-4.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux 2015-11-22 12:50:58 -08:00
powerpc powerpc/tm: Check for already reclaimed tasks 2015-11-23 20:18:03 +11:00
s390 KVM/ARM Fixes for v4.4-rc3. 2015-11-24 19:34:40 +01:00
score
sh
sparc
tile
um
unicore32 pwm: Changes for v4.4-rc1 2015-11-11 09:16:10 -08:00
x86 KVM: nVMX: remove incorrect vpid check in nested invvpid emulation 2015-11-25 15:52:55 +01:00
xtensa
.gitignore
Kconfig