linux/arch
Nathan Lynch a262c2dc83 powerpc/rtas: Prevent Spectre v1 gadget construction in sys_rtas()
commit 0974d03eb4 upstream.

Smatch warns:

  arch/powerpc/kernel/rtas.c:1932 __do_sys_rtas() warn: potential
  spectre issue 'args.args' [r] (local cap)

The 'nargs' and 'nret' locals come directly from a user-supplied
buffer and are used as indexes into a small stack-based array and as
inputs to copy_to_user() after they are subject to bounds checks.

Use array_index_nospec() after the bounds checks to clamp these values
for speculative execution.

Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Reported-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240530-sys_rtas-nargs-nret-v1-1-129acddd4d89@linux.ibm.com
[Minor context change fixed]
Signed-off-by: Cliff Liu <donghua.liu@windriver.com>
Signed-off-by: He Zhe <Zhe.He@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-05-02 07:44:19 +02:00
..
alpha alpha/elf: Fix misc/setarch test of util-linux by removing 32bit support 2025-04-10 14:31:50 +02:00
arc ARC: build: Try to guess GCC variant of cross compiler 2025-01-09 13:28:49 +01:00
arm ARM: Remove address checking for MMUless devices 2025-04-10 14:31:56 +02:00
arm64 KVM: arm64: Eagerly switch ZCR_EL{1,2} 2025-05-02 07:44:17 +02:00
csky csky, hexagon: fix broken sys_sync_file_range 2024-07-05 09:14:48 +02: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 unbalanced spinlock in die() 2025-03-13 12:50:14 +01:00
ia64 arch: Introduce CONFIG_FUNCTION_ALIGNMENT 2024-04-10 16:18:49 +02:00
m68k m68k: vga: Fix I/O defines 2025-03-13 12:50:23 +01:00
microblaze microblaze: don't treat zero reserved memory regions as error 2024-10-17 15:10:38 +02:00
mips MIPS: ftrace: Declare ftrace_get_parent_ra_addr() as static 2025-03-13 12:50:33 +01:00
nds32 exit: Add and use make_task_dead. 2023-02-01 08:27:20 +01:00
nios2 nios2: dts: Fix tse_mac "max-frame-size" property 2023-06-21 15:59:14 +02:00
openrisc openrisc: Call setup_memory() earlier in the init sequence 2024-09-04 13:23:27 +02:00
parisc Revert "parisc: fix a possible DMA corruption" 2024-12-19 18:07:22 +01:00
powerpc powerpc/rtas: Prevent Spectre v1 gadget construction in sys_rtas() 2025-05-02 07:44:19 +02:00
riscv riscv: Avoid fortify warning in syscall_get_arguments() 2025-05-02 07:44:13 +02:00
s390 s390/traps: Fix test_monitor_call() inline assembly 2025-03-13 12:51:03 +01:00
sh sh: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK 2024-12-14 19:51:16 +01:00
sparc sparc/mm: disable preemption in lazy mmu mode 2025-05-02 07:44:04 +02:00
um um: Always dump trace for specified task in show_stack 2024-12-14 19:51:19 +01:00
x86 x86/pvh: Call C code via the kernel virtual mapping 2025-05-02 07:44:18 +02:00
xtensa xtensa: boot/lib: fix function prototypes 2023-10-06 13:18:14 +02:00
.gitignore .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
Kconfig cpu: Re-enable CPU mitigations by default for !X86 architectures 2024-05-02 16:24:48 +02:00