]> www.infradead.org Git - nvme.git/commit
riscv: Fix RISCV_ALTERNATIVE_EARLY
authorAlexandre Ghiti <alexghiti@rivosinc.com>
Thu, 29 Aug 2024 16:50:48 +0000 (18:50 +0200)
committerPalmer Dabbelt <palmer@rivosinc.com>
Tue, 3 Sep 2024 14:57:55 +0000 (07:57 -0700)
commit1ff95eb2bebda50c4c5406caaf201e0fcb24cc8f
treeb8b3edc80782559b63900499e44eea7fe6850431
parent5f771088a2b5edd6f2c5c9f34484ca18dc389f3e
riscv: Fix RISCV_ALTERNATIVE_EARLY

RISCV_ALTERNATIVE_EARLY will issue sbi_ecall() very early in the boot
process, before the first memory mapping is setup so we can't have any
instrumentation happening here.

In addition, when the kernel is relocatable, we must also not issue any
relocation this early since they would have been patched virtually only.

So, instead of disabling instrumentation for the whole kernel/sbi.c file
and compiling it with -fno-pie, simply move __sbi_ecall() and
__sbi_base_ecall() into their own file where this is fixed.

Reported-by: Conor Dooley <conor.dooley@microchip.com>
Closes: https://lore.kernel.org/linux-riscv/20240813-pony-truck-3e7a83e9759e@spud/
Reported-by: syzbot+cfbcb82adf6d7279fd35@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-riscv/00000000000065062c061fcec37b@google.com/
Fixes: 1745cfafebdf ("riscv: don't use global static vars to store alternative data")
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20240829165048.49756-1-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/sbi.h
arch/riscv/kernel/Makefile
arch/riscv/kernel/sbi.c
arch/riscv/kernel/sbi_ecall.c [new file with mode: 0644]