From: Jiri Olsa Date: Fri, 5 Sep 2025 20:57:29 +0000 (+0200) Subject: uprobes/x86: Return error from uprobe syscall when not called from trampoline X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d3aeb6d97b22272bb4783c6d4309d81bb0a4527c;p=thirdparty%2Fkernel%2Fstable.git uprobes/x86: Return error from uprobe syscall when not called from trampoline Currently uprobe syscall handles all errors with forcing SIGILL to current process. As suggested by Andrii it'd be helpful for uprobe syscall detection to return error value for the !in_uprobe_trampoline check. This way we could just call uprobe syscall and based on return value we will find out if the kernel has it. Suggested-by: Andrii Nakryiko Signed-off-by: Jiri Olsa Signed-off-by: Peter Zijlstra (Intel) Acked-by: Andrii Nakryiko Acked-by: Oleg Nesterov --- diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c index 0a8c0a4a54233..845aeaf36b8d2 100644 --- a/arch/x86/kernel/uprobes.c +++ b/arch/x86/kernel/uprobes.c @@ -810,7 +810,7 @@ SYSCALL_DEFINE0(uprobe) /* Allow execution only from uprobe trampolines. */ if (!in_uprobe_trampoline(regs->ip)) - goto sigill; + return -ENXIO; err = copy_from_user(&args, (void __user *)regs->sp, sizeof(args)); if (err)