linux-stable/arch
Ard Biesheuvel ba999a0402 ARM: memcpy: use frame pointer as unwind anchor
The memcpy template is a bit unusual in the way it manages the stack
pointer: depending on the execution path through the function, the SP
assumes different values as different subsets of the register file are
preserved and restored again. This is problematic when it comes to EHABI
unwind info, as it is not instruction accurate, and does not allow
tracking the SP value as it changes.

Commit 279f487e0b ("ARM: 8225/1: Add unwinding support for memory
copy functions") addressed this by carving up the function in different
chunks as far as the unwinder is concerned, and keeping a set of unwind
directives for each of them, each corresponding with the state of the
stack pointer during execution of the chunk in question. This not only
duplicates unwind info unnecessarily, but it also complicates unwinding
the stack upon overflow.

Instead, let's do what the compiler does when the SP is updated halfway
through a function, which is to use a frame pointer and emit the
appropriate unwind directives to communicate this to the unwinder.

Note that Thumb-2 uses R7 for this, while ARM uses R11 aka FP. So let's
avoid touching R7 in the body of the template, so that Thumb-2 can use
it as the frame pointer. R11 was not modified in the first place.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Keith Packard <keithpac@amazon.com>
Tested-by: Marc Zyngier <maz@kernel.org>
Tested-by: Vladimir Murzin <vladimir.murzin@arm.com> # ARMv7M
2021-12-03 15:11:32 +01:00
..
alpha Merge branch 'akpm' (patches from Andrew) 2021-11-09 10:11:53 -08:00
arc Merge branch 'exit-cleanups-for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2021-11-10 16:15:54 -08:00
arm ARM: memcpy: use frame pointer as unwind anchor 2021-12-03 15:11:32 +01:00
arm64 New x86 features: 2021-11-13 10:01:10 -08:00
csky asm-generic: asm/syscall.h cleanup 2021-11-10 11:22:03 -08:00
h8300 Kbuild updates for v5.16 2021-11-08 09:15:45 -08:00
hexagon sched: Add wrapper for get_wchan() to keep task blocked 2021-10-15 11:25:14 +02:00
ia64 asm-generic: asm/syscall.h cleanup 2021-11-10 11:22:03 -08:00
m68k Fixes include: 2021-11-11 14:22:05 -08:00
microblaze asm-generic: asm/syscall.h cleanup 2021-11-10 11:22:03 -08:00
mips Devicetree fixes for v5.16, take 1: 2021-11-14 11:11:51 -08:00
nds32 Merge branch 'exit-cleanups-for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2021-11-10 16:15:54 -08:00
nios2 asm-generic: asm/syscall.h cleanup 2021-11-10 11:22:03 -08:00
openrisc Merge branch 'exit-cleanups-for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2021-11-10 16:15:54 -08:00
parisc parisc/entry: fix trace test in syscall exit path 2021-11-13 22:10:56 +01:00
powerpc mm/migrate.c: remove MIGRATE_PFN_LOCKED 2021-11-11 09:34:35 -08:00
riscv RISC-V Patches for the 5.16 Merge Window, Part 1 2021-11-13 09:15:42 -08:00
s390 s390 updates for the 5.16 merge window #2 2021-11-13 09:18:06 -08:00
sh arch/sh updates for 5.16 2021-11-14 11:37:49 -08:00
sparc Merge branch 'exit-cleanups-for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2021-11-10 16:15:54 -08:00
um Merge branch 'exit-cleanups-for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2021-11-10 16:15:54 -08:00
x86 A single fix for static calls to make the trampoline patching more robust 2021-11-14 10:30:17 -08:00
xtensa Merge branch 'exit-cleanups-for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2021-11-10 16:15:54 -08:00
.gitignore
Kconfig Tracing updates for 5.16: 2021-11-01 20:05:19 -07:00