Thread (29 messages) 29 messages, 5 authors, 10h ago

Re: [PATCHv3 06/12] libbpf: Detect uprobe syscall with new error

From: sashiko-bot@kernel.org
Date: 2026-05-21 13:29:20

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing kernel-side dependency causes selftest failure and feature detection breakage
--

commit 2bfbf90e3446befa63868457a72590c57c20d562
Author: Jiri Olsa [off-list ref]

libbpf: Detect uprobe syscall with new error

This commit updates libbpf feature detection and selftests to expect
EPROTO instead of ENXIO when the uprobe syscall is called outside a
kernel-generated uprobe trampoline.
quoted hunk ↗ jump to hunk
diff --git a/tools/lib/bpf/features.c b/tools/lib/bpf/features.c
index 4f19a0d79b0cf..a37aaea5253e5 100644
--- a/tools/lib/bpf/features.c
+++ b/tools/lib/bpf/features.c
@@ -577,10 +577,10 @@ static int probe_ldimm64_full_range_off(int token_fd)
 static int probe_uprobe_syscall(int token_fd)
 {
 	/*
-	 * If kernel supports uprobe() syscall, it will return -ENXIO when called
+	 * If kernel supports uprobe() syscall, it will return -EPROTO when called
 	 * from the outside of a kernel-generated uprobe trampoline.
 	 */
-	return syscall(__NR_uprobe) < 0 && errno == ENXIO;
+	return syscall(__NR_uprobe) < 0 && errno == EPROTO;
[Severity: High]
Is this patch missing a kernel-side dependency? Looking at the current kernel
tree in arch/x86/kernel/uprobes.c, SYSCALL_DEFINE0(uprobe) still explicitly
returns -ENXIO:

if (!in_uprobe_trampoline(regs->ip))
        return -ENXIO;

Without the corresponding kernel patch to change this to -EPROTO, will
this cause libbpf to incorrectly conclude that the uprobe syscall is
unsupported, and cause the updated selftests below to fail?
 }
[ ... ]
quoted hunk ↗ jump to hunk
diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
index 955a37751b52d..c944136252c6d 100644
--- a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
+++ b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
@@ -762,7 +762,7 @@ static void test_uprobe_error(void)
 	long err = syscall(__NR_uprobe);
 
 	ASSERT_EQ(err, -1, "error");
-	ASSERT_EQ(errno, ENXIO, "errno");
+	ASSERT_EQ(errno, EPROTO, "errno");
 }
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260521124411.31133-7-jolsa@kernel.org?part=1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help