selftests/bpf: include limits.h needed for PATH_MAX directly
Subsystems (3)
Eduard Zingerman
maintainerPATCH 1/1 selftests/bpf: include limits.h needed for PATH_MAX directly
Constant PATH_MAX is used in function unpriv_helpers.c:open_config(). This constant is provided by include file <limits.h>.
The dependency was added by commit [1], which does not include <limits.h> directly, relying instead on <limits.h> being included from zlib.h -> zconf.h.
As it turns out, this is not the case for all systems, e.g. on Fedora 41 zlib 1.3.1 is used, and there <limits.h> is not included from zconf.h. Hence, there is a compilation error on Fedora 41.
[1] commit fc2915bb8bfc ("selftests/bpf: More precise cpu_mitigations state detection")
--- tools/testing/selftests/bpf/unpriv_helpers.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/unpriv_helpers.c +1 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only #include <errno.h> +#include <limits.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h>
Signature · 1 line
2.48.1
Quoted 9 lines · Eduard Zingerman
Constant
PATH_MAXis used in function unpriv_helpers.c:open_config(). This constant is provided by include file <limits.h>.
The dependency was added by commit [1], which does not include <limits.h> directly, relying instead on <limits.h> being included fromzlib.h->zconf.h.
As it turns out, this is not the case for all systems, e.g. on Fedora 41 zlib 1.3.1 is used, and there <limits.h> is not included fromzconf.h. Hence, there is a compilation error on Fedora 41.
Quoted 4 lines
[1] commit
fc2915bb8bfc("selftests/bpf: More precisecpu_mitigationsstate detection")Fixes fc2915bb8bfc ("selftests/bpf: More precise cpu_mitigations state detection")Signed-off-by Eduard Zingerman <[email protected]>
Just ran across this on a ppc Fedora 42. Thanks for the fix, it works!
Quoted 16 lines
--- tools/testing/selftests/bpf/unpriv_helpers.c | 1 + 1 file changed, 1 insertion(+)tools/testing/selftests/bpf/unpriv_helpers.c +1
-0@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only #include <errno.h> +#include <limits.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h>
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 10 lines · On Wed, 18 Jun 2025 02:31:34 -0700 you wrote:
Constant
PATH_MAXis used in function unpriv_helpers.c:open_config(). This constant is provided by include file <limits.h>.
The dependency was added by commit [1], which does not include <limits.h> directly, relying instead on <limits.h> being included fromzlib.h->zconf.h.
As it turns out, this is not the case for all systems, e.g. on Fedora 41 zlib 1.3.1 is used, and there <limits.h> is not included fromzconf.h. Hence, there is a compilation error on Fedora 41.[...]
Here is the summary with links:
- [bpf-next,v1] selftests/bpf: include limits.h needed for PATH_MAX directly
https://git.kernel.org/bpf/bpf-next/c/cd7312a78f36
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html