OpenCloudOS-Kernel/arch/x86/kernel/kprobes
Masami Hiramatsu (Google) 63dc6325ff x86/kprobes: Fix optprobe optimization check with CONFIG_RETHUNK
Since the CONFIG_RETHUNK and CONFIG_SLS will use INT3 for stopping
speculative execution after function return, kprobe jump optimization
always fails on the functions with such INT3 inside the function body.
(It already checks the INT3 padding between functions, but not inside
 the function)

To avoid this issue, as same as kprobes, check whether the INT3 comes
from kgdb or not, and if so, stop decoding and make it fail. The other
INT3 will come from CONFIG_RETHUNK/CONFIG_SLS and those can be
treated as a one-byte instruction.

Fixes: e463a09af2 ("x86: Add straight-line-speculation mitigation")
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/167146051929.1374301.7419382929328081706.stgit@devnote3
2022-12-27 12:51:58 +01:00
..
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
common.h x86,rethook,kprobes: Replace kretprobe with rethook on x86 2022-03-28 19:38:51 -07:00
core.c x86/kprobes: Fix kprobes instruction boudary check with CONFIG_RETHUNK 2022-12-27 12:51:58 +01:00
ftrace.c ftrace: disable preemption when recursion locked 2021-10-27 11:21:49 -04:00
opt.c x86/kprobes: Fix optprobe optimization check with CONFIG_RETHUNK 2022-12-27 12:51:58 +01:00