selftests/bpf: Don't include <linux/ptrace.h> in BPF progs
Subsystems (3)
PATCH 1/1 selftests/bpf: Don't include <linux/ptrace.h> in BPF progs
From: Alexei Starovoitov <[email protected]>
BPF CI cannot build the selftests on aarch64 since its image has new kernel headers:
CLNG-BPF [test_progs] freplace_attach_probe.bpf.o
In file included from progs/freplace_attach_probe.c:4:
In file included from /usr/include/linux/ptrace.h:188:
/usr/include/aarch64-linux-gnu/asm/ptrace.h:96:2: error: unknown type name '__u128'
96 | __u128 vregs[32];
Commit d4bf9e08d412 ("arm64: uapi: Use __u128 instead of __uint128_t in UAPI headers") made asm/ptrace.h use the type of uapi/linux/types.h. BPF progs are built with -Itools/include/uapi, so their <linux/types.h> is the copy in tools, which doesn't have it.
Eight files in progs/ include <linux/ptrace.h>, and 20 progs are built from them: pyperf*, strobemeta*, plain_c_strobemeta_bpf_loop, freplace_attach_probe, test_core_extern, test_perf_branches, test_perf_buffer, test_rdonly_maps. None of them looks into struct pt_regs or uses a PT_REGS_*() macro. At most it is the type that the argument of the prog points to, and bpf_helper_defs.h declares it.
Drop the include. freplace_attach_probe.c replaces a function that takes a struct pt_regs *, and the kernel wants a pointer to a struct there, not to a forward declaration. It takes the type from vmlinux.h.
--- tools/testing/selftests/bpf/progs/freplace_attach_probe.c | 3 +-- .../testing/selftests/bpf/progs/plain_c_strobemeta_bpf_loop.c | 1 - tools/testing/selftests/bpf/progs/pyperf.h | 1 - tools/testing/selftests/bpf/progs/strobemeta.h | 1 - tools/testing/selftests/bpf/progs/test_core_extern.c | 1 - tools/testing/selftests/bpf/progs/test_perf_branches.c | 1 - tools/testing/selftests/bpf/progs/test_perf_buffer.c | 1 - tools/testing/selftests/bpf/progs/test_rdonly_maps.c | 1 - 8 files changed, 1 insertion(+), 9 deletions(-)
tools/testing/selftests/bpf/progs/freplace_attach_probe.c +1 -2
@@ -1,8 +1,7 @@// SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Facebook -#include <linux/ptrace.h> -#include <linux/bpf.h> +#include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h>
tools/testing/selftests/bpf/progs/plain_c_strobemeta_bpf_loop.c +0 -1
@@ -12,7 +12,6 @@#include <stddef.h> #include <stdbool.h> #include <linux/bpf.h> -#include <linux/ptrace.h> #include <linux/sched.h> #include <linux/types.h> #include <bpf/bpf_helpers.h>
tools/testing/selftests/bpf/progs/pyperf.h +0 -1
@@ -1,7 +1,6 @@// SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include <linux/sched.h> -#include <linux/ptrace.h> #include <stdint.h> #include <stddef.h> #include <stdbool.h>
tools/testing/selftests/bpf/progs/strobemeta.h +0 -1
@@ -5,7 +5,6 @@#include <stddef.h> #include <stdbool.h> #include <linux/bpf.h> -#include <linux/ptrace.h> #include <linux/sched.h> #include <linux/types.h> #include <bpf/bpf_helpers.h>
tools/testing/selftests/bpf/progs/test_core_extern.c +0 -1
@@ -3,7 +3,6 @@#include <stdint.h> #include <stdbool.h> -#include <linux/ptrace.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h>
tools/testing/selftests/bpf/progs/test_perf_branches.c +0 -1
@@ -2,7 +2,6 @@// Copyright (c) 2019 Facebook #include <stddef.h> -#include <linux/ptrace.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h>
tools/testing/selftests/bpf/progs/test_perf_buffer.c +0 -1
@@ -1,7 +1,6 @@// SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook -#include <linux/ptrace.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h>
tools/testing/selftests/bpf/progs/test_rdonly_maps.c +0 -1
@@ -1,7 +1,6 @@// SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook -#include <linux/ptrace.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h"
Signature · 1 line
2.55.0
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Quoted 5 lines · On Sun, 8 Nov 2026 16:37:10 +0000 you wrote:
From: Alexei Starovoitov <[email protected]>
BPF CI cannot build the selftests on aarch64 since its image has new kernel headers:
Quoted 7 lines
CLNG-BPF [
test_progs] freplace_attach_probe.bpf.o
In file included fromprogs/freplace_attach_probe.c:4:
In file included from/usr/include/linux/ptrace.h:188:
/usr/include/aarch64-linux-gnu/asm/ptrace.h:96:2: error: unknown type name '__u128'96 | __u128 vregs[32];[...]
Here is the summary with links:
- [bpf-next] selftests/bpf: Don't include <linux/ptrace.h> in BPF progs
https://git.kernel.org/bpf/bpf-next/c/a0a0c785cbca
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Ihor Solodrai
reviewerQuoted 4 lines · On 11/8/26 11:50 AM, [email protected] wrote:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Alexei,
I added this patch to BPF CI diffs today, but it doesn't apply to bpf, and so aarch64 selftests build on bpf-targeting branches and on linux-next remains broken:
* https://github.com/kernel-patches/bpf/actions/runs/42712433047/job/129485446405
* https://github.com/kernel-patches/bpf/actions/runs/42679811664/job/129371245681
I think this should've gone through the bpf tree. Fixing bpf now separately will likely cause conflicts later.
Quoted 20 lines · On Sun, 8 Nov 2026 16:37:10 +0000 you wrote:
Quoted 5 lines
From: Alexei Starovoitov <[email protected]>
BPF CI cannot build the selftests on aarch64 since its image has new kernel headers:
Quoted 7 lines
CLNG-BPF [
test_progs] freplace_attach_probe.bpf.o
In file included fromprogs/freplace_attach_probe.c:4:
In file included from/usr/include/linux/ptrace.h:188:
/usr/include/aarch64-linux-gnu/asm/ptrace.h:96:2: error: unknown type name '__u128'96 | __u128 vregs[32];[...]
Here is the summary with links:
- [bpf-next] selftests/bpf: Don't include <linux/ptrace.h> in BPF progshttps://git.kernel.org/bpf/bpf-next/c/a0a0c785cbcaYou are awesome, thank you!