]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
riscv: uprobes: Add missing fence.i after building the XOL buffer
authorBjörn Töpel <bjorn@rivosinc.com>
Wed, 14 Jan 2026 01:18:30 +0000 (09:18 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Jan 2026 15:30:00 +0000 (16:30 +0100)
commit77c956152a3a7c7a18b68f3654f70565b2181d03
treec4f8ef83ade9a12f368af5e4fc2fc765202693c4
parent5c7c4131beade68a52dacfc7d7fede833a396837
riscv: uprobes: Add missing fence.i after building the XOL buffer

[ Upstream commit 7d1d19a11cfbfd8bae1d89cc010b2cc397cd0c48 ]

The XOL (execute out-of-line) buffer is used to single-step the
replaced instruction(s) for uprobes. The RISC-V port was missing a
proper fence.i (i$ flushing) after constructing the XOL buffer, which
can result in incorrect execution of stale/broken instructions.

This was found running the BPF selftests "test_progs:
uprobe_autoattach, attach_probe" on the Spacemit K1/X60, where the
uprobes tests randomly blew up.

Reviewed-by: Guo Ren <guoren@kernel.org>
Fixes: 74784081aac8 ("riscv: Add uprobes supported")
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Link: https://lore.kernel.org/r/20250419111402.1660267-2-bjorn@kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Rahul Sharma <black.hawk@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/riscv/kernel/probes/uprobes.c