linux/arch/riscv/kernel/probes
Fabian Vogt 9e68bd803f riscv: kprobes: Fix probe address validation
When adding a kprobe such as "p:probe/tcp_sendmsg _text+15392192",
arch_check_kprobe would start iterating all instructions starting from
_text until the probed address. Not only is this very inefficient, but
literal values in there (e.g. left by function patching) are
misinterpreted in a way that causes a desync.

Fix this by doing it like x86: start the iteration at the closest
preceding symbol instead of the given starting point.

Fixes: 87f48c7ccc ("riscv: kprobe: Fixup kernel panic when probing an illegal position")
Signed-off-by: Fabian Vogt <fvogt@suse.de>
Signed-off-by: Marvin Friedrich <marvin.friedrich@suse.com>
Acked-by: Guo Ren <guoren@kernel.org>
Link: https://lore.kernel.org/r/6191817.lOV4Wx5bFT@fvogt-thinkpad
Signed-off-by: Paul Walmsley <pjw@kernel.org>
2025-10-09 19:36:45 -06:00
..
decode-insn.c riscv: kprobes: simulate c.beqz and c.bnez 2023-08-16 07:48:40 -07:00
decode-insn.h
kprobes.c riscv: kprobes: Fix probe address validation 2025-10-09 19:36:45 -06:00
Makefile trace: riscv: Remove deprecated kprobe on ftrace support 2024-07-24 06:14:05 -07:00
rethook_trampoline.S riscv: Use SYM_*() assembly macros instead of deprecated ones 2023-11-06 09:42:47 -08:00
rethook.c riscv: add riscv rethook implementation 2022-12-02 13:04:05 -08:00
rethook.h riscv: add riscv rethook implementation 2022-12-02 13:04:05 -08:00
simulate-insn.c riscv: kprobes: Remove duplication of RV_EXTRACT_ITYPE_IMM 2025-09-16 18:46:44 -06:00
simulate-insn.h riscv: kprobes: simulate c.beqz and c.bnez 2023-08-16 07:48:40 -07:00
uprobes.c riscv: uprobes: Add missing fence.i after building the XOL buffer 2025-04-24 13:20:02 -07:00