android_kernel_xiaomi_sm8350/arch/x86
Chen Zhongjin 2668aeac01 x86/unwind/orc: Unwind ftrace trampolines with correct ORC entry
commit fc2e426b1161761561624ebd43ce8c8d2fa058da upstream.

When meeting ftrace trampolines in ORC unwinding, unwinder uses address
of ftrace_{regs_}call address to find the ORC entry, which gets next frame at
sp+176.

If there is an IRQ hitting at sub $0xa8,%rsp, the next frame should be
sp+8 instead of 176. It makes unwinder skip correct frame and throw
warnings such as "wrong direction" or "can't access registers", etc,
depending on the content of the incorrect frame address.

By adding the base address ftrace_{regs_}caller with the offset
*ip - ops->trampoline*, we can get the correct address to find the ORC entry.

Also change "caller" to "tramp_addr" to make variable name conform to
its content.

[ mingo: Clarified the changelog a bit. ]

Fixes: 6be7fa3c74 ("ftrace, orc, x86: Handle ftrace dynamically allocated trampolines")
Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220819084334.244016-1-chenzhongjin@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-05 10:27:43 +02:00
..
boot x86: link vdso and boot with -z noexecstack --no-warn-rwx-segments 2022-08-25 11:17:17 +02:00
configs
crypto crypto: x86/chacha20 - Avoid spurious jumps to other functions 2022-05-25 09:14:32 +02:00
entry x86: link vdso and boot with -z noexecstack --no-warn-rwx-segments 2022-08-25 11:17:17 +02:00
events perf/amd/ibs: Use interrupt regs ip for stack unwinding 2022-06-14 18:11:36 +02:00
hyperv
ia32
include x86/speculation: Add LFENCE to RSB fill sequence 2022-08-11 12:57:53 +02:00
kernel x86/unwind/orc: Unwind ftrace trampolines with correct ORC entry 2022-09-05 10:27:43 +02:00
kvm KVM: x86: Avoid theoretical NULL pointer dereference in kvm_irq_delivery_to_apic_fast() 2022-08-25 11:18:16 +02:00
lib x86/delay: Fix the wrong asm constraint in delay_loop() 2022-06-14 18:11:31 +02:00
math-emu
mm x86/numa: Use cpumask_available instead of hardcoded NULL check 2022-08-25 11:18:08 +02:00
net
oprofile
pci x86/pci/xen: Disable PCI/MSI[-X] masking for XEN_HVM guests 2022-06-06 08:33:48 +02:00
platform x86/olpc: fix 'logical not is only applied to the left hand side' 2022-08-25 11:18:10 +02:00
power x86/cpu: Load microcode during restore_processor_state() 2022-05-09 09:03:27 +02:00
purgatory
ras
realmode
tools
um um: Fix out-of-bounds read in LDT setup 2022-06-14 18:11:48 +02:00
video
xen x86/xen: fix booting 32-bit pv guest 2022-05-25 09:14:38 +02:00
.gitignore
Kbuild
Kconfig locking/refcount: Consolidate implementations of refcount_t 2022-07-29 17:14:17 +02:00
Kconfig.cpu
Kconfig.debug
Makefile
Makefile_32.cpu
Makefile.um