linux/arch
Alexandre Ghiti 6ca445d8af
riscv: Fix early ftrace nop patching
Commit c97bf62996 ("riscv: Fix text patching when IPI are used")
converted ftrace_make_nop() to use patch_insn_write() which does not
emit any icache flush relying entirely on __ftrace_modify_code() to do
that.

But we missed that ftrace_make_nop() was called very early directly when
converting mcount calls into nops (actually on riscv it converts 2B nops
emitted by the compiler into 4B nops).

This caused crashes on multiple HW as reported by Conor and Björn since
the booting core could have half-patched instructions in its icache
which would trigger an illegal instruction trap: fix this by emitting a
local flush icache when early patching nops.

Fixes: c97bf62996 ("riscv: Fix text patching when IPI are used")
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reported-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
Tested-by: Björn Töpel <bjorn@rivosinc.com>
Link: https://lore.kernel.org/r/20240523115134.70380-1-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2024-05-23 08:22:17 -07:00
..
alpha The usual shower of singleton fixes and minor series all over MM, 2024-05-19 09:21:03 -07:00
arc asm-generic cleanups for 6.10 2024-05-20 15:18:34 -07:00
arm asm-generic cleanups for 6.10 2024-05-20 15:18:34 -07:00
arm64 asm-generic cleanups for 6.10 2024-05-20 15:18:34 -07:00
csky The usual shower of singleton fixes and minor series all over MM, 2024-05-19 09:21:03 -07:00
hexagon hexagon: vmlinux.lds.S: handle attributes section 2024-03-26 11:07:23 -07:00
loongarch LoongArch changes for v6.10 2024-05-22 09:43:07 -07:00
m68k m68knommu: updates and fixes for v6.10 2024-05-21 12:05:40 -07:00
microblaze Microblaze patches for 6.10-rc1 2024-05-22 09:31:01 -07:00
mips asm-generic cleanups for 6.10 2024-05-20 15:18:34 -07:00
nios2 Kbuild updates for v6.10 2024-05-18 12:39:20 -07:00
openrisc openrisc: Move FPU state out of pt_regs 2024-04-15 15:20:39 +01:00
parisc asm-generic cleanups for 6.10 2024-05-20 15:18:34 -07:00
powerpc asm-generic cleanups for 6.10 2024-05-20 15:18:34 -07:00
riscv riscv: Fix early ftrace nop patching 2024-05-23 08:22:17 -07:00
s390 more s390 updates for 6.10 merge window 2024-05-21 12:09:36 -07:00
sh asm-generic cleanups for 6.10 2024-05-20 15:18:34 -07:00
sparc asm-generic cleanups for 6.10 2024-05-20 15:18:34 -07:00
um asm-generic cleanups for 6.10 2024-05-20 15:18:34 -07:00
x86 pci-v6.10-changes 2024-05-21 10:09:28 -07:00
xtensa The usual shower of singleton fixes and minor series all over MM, 2024-05-19 09:21:03 -07:00
.gitignore
Kconfig kprobes: remove dependency on CONFIG_MODULES 2024-05-14 00:35:06 -07:00