[RFC PATCH 16/27] x86/error_inject: Use CET helpers to insert just_return_func trampoline
From: K Prateek Nayak
Date: Sun Nov 29 2026 - 17:35:04 EST
Use regs_set_return_ip() to insert the retun to just_return_func. Unlike
a return trampoline, the just_return_func hijacks the return from
ftrace_regs_caller / int3 breakpoint (much like the direct hump path
from ftrace_regs_caller) to jump to execute just_return_func which
directly returns to the caller's slot.
Signed-off-by: K Prateek Nayak <kprateek.nayak@xxxxxxx>
---
arch/x86/lib/error-inject.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/lib/error-inject.c b/arch/x86/lib/error-inject.c
index 512a2538596f..f64469d350f2 100644
--- a/arch/x86/lib/error-inject.c
+++ b/arch/x86/lib/error-inject.c
@@ -20,6 +20,6 @@ asm(
void override_function_with_return(struct pt_regs *regs)
{
- regs->ip = (unsigned long)&just_return_func;
+ regs_set_return_ip(regs, (unsigned long)&just_return_func);
}
NOKPROBE_SYMBOL(override_function_with_return);
--
2.43.0