Commit 706ed11a authored by Fabian Vogt's avatar Fabian Vogt Committed by Greg Kroah-Hartman
Browse files

riscv: kprobes: Fix probe address validation



[ Upstream commit 9e68bd80 ]

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: 87f48c7c ("riscv: kprobe: Fixup kernel panic when probing an illegal position")
Signed-off-by: default avatarFabian Vogt <fvogt@suse.de>
Signed-off-by: default avatarMarvin Friedrich <marvin.friedrich@suse.com>
Acked-by: default avatarGuo Ren <guoren@kernel.org>
Link: https://lore.kernel.org/r/6191817.lOV4Wx5bFT@fvogt-thinkpad


Signed-off-by: default avatarPaul Walmsley <pjw@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 06da9b0f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment