android_kernel_samsung_a7y1.../arch
Vasily Gorbik 0fc49dee84 s390/ftrace: generate traced function stack frame
[ Upstream commit 45f7a0da600d3c409b5ad8d5ddddacd98ddc8840 ]

Currently backtrace from ftraced function does not contain ftraced
function itself. e.g. for "path_openat":

arch_stack_walk+0x15c/0x2d8
stack_trace_save+0x50/0x68
stack_trace_call+0x15e/0x3d8
ftrace_graph_caller+0x0/0x1c <-- ftrace code
do_filp_open+0x7c/0xe8 <-- ftraced function caller
do_open_execat+0x76/0x1b8
open_exec+0x52/0x78
load_elf_binary+0x180/0x1160
search_binary_handler+0x8e/0x288
load_script+0x2a8/0x2b8
search_binary_handler+0x8e/0x288
__do_execve_file.isra.39+0x6fa/0xb40
__s390x_sys_execve+0x56/0x68
system_call+0xdc/0x2d8

Ftraced function is expected in the backtrace by ftrace kselftests, which
are now failing. It would also be nice to have it for clarity reasons.

"ftrace_caller" itself is called without stack frame allocated for it
and does not store its caller (ftraced function). Instead it simply
allocates a stack frame for "ftrace_trace_function" and sets backchain
to point to ftraced function stack frame (which contains ftraced function
caller in saved r14).

To fix this issue make "ftrace_caller" allocate a stack frame
for itself just to store ftraced function for the stack unwinder.
As a result backtrace looks like the following:

arch_stack_walk+0x15c/0x2d8
stack_trace_save+0x50/0x68
stack_trace_call+0x15e/0x3d8
ftrace_graph_caller+0x0/0x1c <-- ftrace code
path_openat+0x6/0xd60  <-- ftraced function
do_filp_open+0x7c/0xe8 <-- ftraced function caller
do_open_execat+0x76/0x1b8
open_exec+0x52/0x78
load_elf_binary+0x180/0x1160
search_binary_handler+0x8e/0x288
load_script+0x2a8/0x2b8
search_binary_handler+0x8e/0x288
__do_execve_file.isra.39+0x6fa/0xb40
__s390x_sys_execve+0x56/0x68
system_call+0xdc/0x2d8

Reported-by: Sven Schnelle <sven.schnelle@ibm.com>
Tested-by: Sven Schnelle <sven.schnelle@ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-07 13:57:03 +02:00
..
alpha
arc ARC: [plat-axs10x]: Add missing multicast filter number to GMAC node 2020-04-07 13:54:37 +02:00
arm ARM: dts: r8a7779: Add device node for ARM global timer 2020-04-07 13:56:26 +02:00
arm64 arm64: kbuild: remove compressed images on 'make ARCH=arm64 (dist)clean' 2020-04-07 13:48:08 +02:00
avr32
blackfin
c6x
cris
frv
h8300 h8300: use cc-cross-prefix instead of hardcoding h8300-unknown-linux- 2020-04-06 14:21:05 +02:00
hexagon hexagon: work around compiler crash 2020-04-07 13:37:21 +02:00
ia64 ia64:unwind: fix double free for mod->arch.init_unw_table 2020-04-07 07:38:19 +02:00
m32r
m68k m68k: Call timer_interrupt() with interrupts disabled 2020-04-07 13:44:29 +02:00
metag
microblaze microblaze: move "... is ready" messages to arch/microblaze/Makefile 2020-04-07 12:41:36 +02:00
mips MIPS: Loongson: Fix potential NULL dereference in loongson3_platform_init() 2020-04-07 13:55:46 +02:00
mn10300
nios2 nios2: ksyms: Add missing symbol exports 2020-04-07 13:40:50 +02:00
openrisc openrisc: Fix broken paths to arch/or32 2020-04-07 12:42:07 +02:00
parisc parisc: Fix compiler warnings in debug_core.c 2020-04-07 13:29:00 +02:00
powerpc powerpc/pseries: Allow not having ibm, hypertas-functions::hcall-multi-tce for DDW 2020-04-07 13:54:43 +02:00
s390 s390/ftrace: generate traced function stack frame 2020-04-07 13:57:03 +02:00
score
sh pinctrl: sh-pfc: sh7269: Fix CAN function GPIOs 2020-04-07 13:56:29 +02:00
sparc sparc32: fix struct ipc64_perm type definition 2020-04-07 13:49:17 +02:00
tile locking/x86: Remove the unused atomic_inc_short() methd 2020-04-07 13:25:08 +02:00
um um: Make GCOV depend on !KCOV 2020-04-07 12:42:32 +02:00
unicore32
x86 x86/vdso: Provide missing include file 2020-04-07 13:56:27 +02:00
xtensa xtensa: fix TLB sanity checker 2020-04-07 13:12:45 +02:00
Kconfig