WSL2-Linux-Kernel/arch
Ard Biesheuvel 402d2b1d54 arm64: Stash shadow stack pointer in the task struct on interrupt
commit 59b37fe52f upstream.

Instead of reloading the shadow call stack pointer from the ordinary
stack, which may be vulnerable to the kind of gadget based attacks
shadow call stacks were designed to prevent, let's store a task's shadow
call stack pointer in the task struct when switching to the shadow IRQ
stack.

Given that currently, the task_struct::scs_sp field is only used to
preserve the shadow call stack pointer while a task is scheduled out or
running in user space, reusing this field to preserve and restore it
while running off the IRQ stack must be safe, as those occurrences are
guaranteed to never overlap. (The stack switching logic only switches
stacks when running from the task stack, and so the value being saved
here always corresponds to the task mode shadow stack)

While at it, fold a mov/add/mov sequence into a single add.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20230109174800.3286265-3-ardb@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-11 23:00:15 +09:00
..
alpha alpha: fix R_ALPHA_LITERAL reloc for large modules 2023-03-17 08:49:01 +01:00
arc arc: iounmap() arg is volatile 2022-11-03 23:59:15 +09:00
arm ARM: dts: rockchip: fix a typo error for rk3288 spdif node 2023-04-26 13:51:46 +02:00
arm64 arm64: Stash shadow stack pointer in the task struct on interrupt 2023-05-11 23:00:15 +09:00
csky kprobes: treewide: Cleanup the error messages for kprobes 2023-02-22 12:57:00 +01:00
h8300 h8300: Fix build errors from do_exit() to make_task_dead() transition 2023-02-01 08:27:21 +01:00
hexagon hexagon: Fix function name in die() 2023-02-01 08:27:20 +01:00
ia64 genirq: Add and use an irq_data_update_affinity helper 2023-03-11 13:57:31 +01:00
m68k m68k: Only force 030 bus error if PC not in exception table 2023-03-30 12:47:53 +02:00
microblaze exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
mips MIPS: Define RUNTIME_DISCARD_EXIT in LD script 2023-04-26 13:51:53 +02:00
nds32 exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
nios2 exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
openrisc exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
parisc genirq: Add and use an irq_data_update_affinity helper 2023-03-11 13:57:31 +01:00
powerpc powerpc/papr_scm: Update the NUMA distance table for the target node 2023-04-20 12:13:56 +02:00
riscv riscv: No need to relocate the dtb as it lies in the fixmap region 2023-05-01 08:23:24 +09:00
s390 s390/ptrace: fix PTRACE_GET_LAST_BREAK error handling 2023-04-26 13:51:50 +02:00
sh sh: sanitize the flags on sigreturn 2023-03-30 12:47:54 +02:00
sparc sparc: allow PM configs for sparc32 COMPILE_TEST 2023-03-10 09:39:33 +01:00
um UML: define RUNTIME_DISCARD_EXIT 2023-03-17 08:49:04 +01:00
x86 x86/cpu: Add model number for Intel Arrow Lake processor 2023-05-11 23:00:15 +09:00
xtensa xtensa: fix KASAN report for show_stack 2023-04-05 11:25:00 +02:00
.gitignore
Kconfig arch: make TRACE_IRQFLAGS_NMI_SUPPORT generic 2022-08-17 14:23:00 +02:00