original_kernel/arch/riscv/kernel
Sergey Matyukevich a638b0461b
riscv: prevent pt_regs corruption for secondary idle threads
Top of the kernel thread stack should be reserved for pt_regs. However
this is not the case for the idle threads of the secondary boot harts.
Their stacks overlap with their pt_regs, so both may get corrupted.

Similar issue has been fixed for the primary hart, see c7cdd96eca
("riscv: prevent stack corruption by reserving task_pt_regs(p) early").
However that fix was not propagated to the secondary harts. The problem
has been noticed in some CPU hotplug tests with V enabled. The function
smp_callin stored several registers on stack, corrupting top of pt_regs
structure including status field. As a result, kernel attempted to save
or restore inexistent V context.

Fixes: 9a2451f186 ("RISC-V: Avoid using per cpu array for ordered booting")
Fixes: 2875fe0561 ("RISC-V: Add cpu_ops and modify default booting method")
Signed-off-by: Sergey Matyukevich <sergey.matyukevich@syntacore.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20240523084327.2013211-1-geomatsi@gmail.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2024-05-30 09:42:51 -07:00
..
compat_vdso
pi
probes
tests
vdso
.gitignore
Makefile
acpi.c
alternative.c
asm-offsets.c ftrace: riscv: move from REGS to ARGS 2024-05-22 16:12:48 -07:00
cacheinfo.c
cfi.c
compat_signal.c
compat_syscall_table.c
copy-unaligned.S
copy-unaligned.h
cpu-hotplug.c
cpu.c riscv: cpufeature: Fix thead vector hwcap removal 2024-05-22 09:41:02 -07:00
cpu_ops.c
cpu_ops_sbi.c riscv: prevent pt_regs corruption for secondary idle threads 2024-05-30 09:42:51 -07:00
cpu_ops_spinwait.c riscv: prevent pt_regs corruption for secondary idle threads 2024-05-30 09:42:51 -07:00
cpufeature.c riscv: cpufeature: Fix extension subset checking 2024-05-22 09:41:03 -07:00
crash_dump.c
crash_save_regs.S
efi-header.S
efi.c
elf_kexec.c
entry.S
fpu.S riscv: typo in comment for get_f64_reg 2024-05-22 16:12:53 -07:00
ftrace.c riscv: Fix early ftrace nop patching 2024-05-23 08:22:17 -07:00
head.S
head.h
hibernate-asm.S
hibernate.c
image-vars.h
irq.c
jump_label.c
kernel_mode_fpu.c
kernel_mode_vector.c
kexec_relocate.S
kgdb.c
machine_kexec.c
machine_kexec_file.c
mcount-dyn.S ftrace: riscv: move from REGS to ARGS 2024-05-22 16:12:48 -07:00
mcount.S
module-sections.c
module.c
paravirt.c
patch.c RISC-V Patches for the 6.10 Merge Window, Part 1 2024-05-22 09:56:00 -07:00
perf_callchain.c
perf_regs.c
process.c
ptrace.c
reset.c
return_address.c
riscv_ksyms.c
sbi-ipi.c
sbi.c
setup.c
signal.c
smp.c
smpboot.c Use bool value in set_cpu_online() 2024-05-22 16:12:52 -07:00
soc.c
stacktrace.c riscv: stacktrace: fixed walk_stackframe() 2024-05-22 16:12:49 -07:00
suspend.c
suspend_entry.S
sys_hwprobe.c
sys_riscv.c
syscall_table.c
time.c
traps.c
traps_misaligned.c
unaligned_access_speed.c
vdso.c
vector.c
vmcore_info.c
vmlinux-xip.lds.S
vmlinux.lds.S