[PATCH] tools: Ensure tools copy of linux/filter.h exports the UAPI

Mark Brown posted 1 patch 1 month, 3 weeks ago
tools/include/linux/filter.h | 1 +
1 file changed, 1 insertion(+)
[PATCH] tools: Ensure tools copy of linux/filter.h exports the UAPI
Posted by Mark Brown 1 month, 3 weeks ago
Normally when there is an include/foo.h and an include/uapi/foo.h the
non-UAPI copy includes the UAPI copy.  This is the case for the in
kernel copy of linux/filter.h but not for the copy in tools/ which
results in build breaks for the newly added arm64
seccomp_ptrace_x0_bypass selftest.  Add an explicit include of the uapi
to fix the test and avoid future surprises.

Fixes: 2fcbc4adf997 ("kselftest/arm64: Add seccomp ptrace x0 bypass test")
Fixes: f143c11bb7b9 ("tools: bpf: Use local copy of headers including uapi/linux/filter.h")
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 tools/include/linux/filter.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/include/linux/filter.h b/tools/include/linux/filter.h
index bcc6df79301a..4ead4e72097c 100644
--- a/tools/include/linux/filter.h
+++ b/tools/include/linux/filter.h
@@ -6,6 +6,7 @@
 #define __TOOLS_LINUX_FILTER_H
 
 #include <linux/bpf.h>
+#include <uapi/linux/filter.h>
 
 /* ArgX, context and stack frame pointer register positions. Note,
  * Arg1, Arg2, Arg3, etc are used as argument mappings of function

---
base-commit: 2fcbc4adf99790564b83381b2f239294185603d5
change-id: 20260805-arm64-selftest-fix-filter-h-build-a6da720750b7

Best regards,
--  
Mark Brown <broonie@kernel.org>
Re: [PATCH] tools: Ensure tools copy of linux/filter.h exports the UAPI
Posted by Will Deacon 1 month, 3 weeks ago
On Wed, 05 Aug 2026 22:32:23 +0100, Mark Brown wrote:
> Normally when there is an include/foo.h and an include/uapi/foo.h the
> non-UAPI copy includes the UAPI copy.  This is the case for the in
> kernel copy of linux/filter.h but not for the copy in tools/ which
> results in build breaks for the newly added arm64
> seccomp_ptrace_x0_bypass selftest.  Add an explicit include of the uapi
> to fix the test and avoid future surprises.
> 
> [...]

Applied to arm64 (for-next/selftests), thanks!

[1/1] tools: Ensure tools copy of linux/filter.h exports the UAPI
      https://git.kernel.org/arm64/c/7a1f400ff5e5

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
Re: [PATCH] tools: Ensure tools copy of linux/filter.h exports the UAPI
Posted by Will Deacon 1 month, 3 weeks ago
On Wed, Aug 05, 2026 at 10:32:23PM +0100, Mark Brown wrote:
> Normally when there is an include/foo.h and an include/uapi/foo.h the
> non-UAPI copy includes the UAPI copy.  This is the case for the in
> kernel copy of linux/filter.h but not for the copy in tools/ which
> results in build breaks for the newly added arm64
> seccomp_ptrace_x0_bypass selftest.  Add an explicit include of the uapi
> to fix the test and avoid future surprises.
> 
> Fixes: 2fcbc4adf997 ("kselftest/arm64: Add seccomp ptrace x0 bypass test")
> Fixes: f143c11bb7b9 ("tools: bpf: Use local copy of headers including uapi/linux/filter.h")
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>  tools/include/linux/filter.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/include/linux/filter.h b/tools/include/linux/filter.h
> index bcc6df79301a..4ead4e72097c 100644
> --- a/tools/include/linux/filter.h
> +++ b/tools/include/linux/filter.h
> @@ -6,6 +6,7 @@
>  #define __TOOLS_LINUX_FILTER_H
>  
>  #include <linux/bpf.h>
> +#include <uapi/linux/filter.h>
>  
>  /* ArgX, context and stack frame pointer register positions. Note,
>   * Arg1, Arg2, Arg3, etc are used as argument mappings of function

Is this still needed if we take the test changes from Jinjie?

https://lore.kernel.org/r/20260806090935.39311-1-ruanjinjie@huawei.com

Will
Re: [PATCH] tools: Ensure tools copy of linux/filter.h exports the UAPI
Posted by Jinjie Ruan 1 month, 3 weeks ago

在 2026/8/6 19:00, Will Deacon 写道:
> On Wed, Aug 05, 2026 at 10:32:23PM +0100, Mark Brown wrote:
>> Normally when there is an include/foo.h and an include/uapi/foo.h the
>> non-UAPI copy includes the UAPI copy.  This is the case for the in
>> kernel copy of linux/filter.h but not for the copy in tools/ which
>> results in build breaks for the newly added arm64
>> seccomp_ptrace_x0_bypass selftest.  Add an explicit include of the uapi
>> to fix the test and avoid future surprises.
>>
>> Fixes: 2fcbc4adf997 ("kselftest/arm64: Add seccomp ptrace x0 bypass test")
>> Fixes: f143c11bb7b9 ("tools: bpf: Use local copy of headers including uapi/linux/filter.h")
>> Signed-off-by: Mark Brown <broonie@kernel.org>
>> ---
>>  tools/include/linux/filter.h | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/tools/include/linux/filter.h b/tools/include/linux/filter.h
>> index bcc6df79301a..4ead4e72097c 100644
>> --- a/tools/include/linux/filter.h
>> +++ b/tools/include/linux/filter.h
>> @@ -6,6 +6,7 @@
>>  #define __TOOLS_LINUX_FILTER_H
>>  
>>  #include <linux/bpf.h>
>> +#include <uapi/linux/filter.h>
>>  
>>  /* ArgX, context and stack frame pointer register positions. Note,
>>   * Arg1, Arg2, Arg3, etc are used as argument mappings of function
> 
> Is this still needed if we take the test changes from Jinjie?
> 
> https://lore.kernel.org/r/20260806090935.39311-1-ruanjinjie@huawei.com

I think both of these are needed for the fix.

https://lore.kernel.org/all/20260806111546.42042-1-ruanjinjie@huawei.com/

> 
> Will
> 

Re: [PATCH] tools: Ensure tools copy of linux/filter.h exports the UAPI
Posted by Mark Brown 1 month, 3 weeks ago
On Thu, Aug 06, 2026 at 07:21:45PM +0800, Jinjie Ruan wrote:
> 在 2026/8/6 19:00, Will Deacon 写道:

> >> +#include <uapi/linux/filter.h>

> > Is this still needed if we take the test changes from Jinjie?

> > https://lore.kernel.org/r/20260806090935.39311-1-ruanjinjie@huawei.com

> I think both of these are needed for the fix.

> https://lore.kernel.org/all/20260806111546.42042-1-ruanjinjie@huawei.com/

Yes, we need both - with just the include change we still have the issue
that nothing in the test inclues the uapi header directly, nor would we
expect the test to have to do that.