net/ipv4: fix linux/in.h header dependencies
Subsystems (3)
Andrii Nakryiko
maintainerPATCH 1/2 net/ipv4: fix linux/in.h header dependencies
__DECLARE_FLEX_ARRAY is defined in include/uapi/linux/stddef.h but doesn't seem to be explicitly included from include/uapi/linux/in.h, which breaks BPF selftests builds (once we sync linux/stddef.h into tools/include directory in the next patch). Fix this by explicitly including linux/stddef.h.
Given this affects BPF CI and bpf tree, targeting this for bpf tree.
--- include/uapi/linux/in.h | 1 + 1 file changed, 1 insertion(+)
include/uapi/linux/in.h +1 -0
@@ -20,6 +20,7 @@#define _UAPI_LINUX_IN_H#include <linux/types.h> +#include <linux/stddef.h> #include <linux/libc-compat.h> #include <linux/socket.h>
Signature · 1 line
2.30.2
Andrii Nakryiko
maintainerPATCH 2/2 tools headers uapi: pull in stddef.h to fix BPF selftests build in CI
With recent sync of linux/in.h tools/include headers are now relying on __DECLARE_FLEX_ARRAY macro, which isn't itself defined inside tools/include headers anywhere and is instead assumed to be present in system-wide UAPI header. This breaks isolated environments that don't have kernel UAPI headers installed system-wide, like BPF CI ([0]).
To fix this, bring in include/uapi/linux/stddef.h into tools/include. We can't just copy/paste it, though, it has to be processed with scripts/headers_install.sh, which has a dependency on scripts/unifdef. So the full command to (re-)generate stddef.h for inclusion into tools/include directory is:
$ make scripts_unifdef && \
cp $KBUILD_OUTPUT/scripts/unifdef scripts/ && \
scripts/headers_install.sh include/uapi/linux/stddef.h tools/include/uapi/linux/stddef.hThis assumes KBUILD_OUTPUT envvar is set and used for out-of-tree builds.
[0] https://github.com/kernel-patches/bpf/actions/runs/3379432493/jobs/5610982609
--- tools/include/uapi/linux/in.h | 1 + tools/include/uapi/linux/stddef.h | 47 +++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 tools/include/uapi/linux/stddef.h
tools/include/uapi/linux/in.h +1 -0
@@ -20,6 +20,7 @@#define _UAPI_LINUX_IN_H#include <linux/types.h> +#include <linux/stddef.h> #include <linux/libc-compat.h> #include <linux/socket.h>
tools/include/uapi/linux/stddef.h new file +47 -0
47 lines not on this page · raw message
Signature · 1 line
2.30.2
This series was applied to bpf/bpf.git (master) by Daniel Borkmann <[email protected]>:
Hello:
This series was applied to bpf/bpf.git (master)
by Daniel Borkmann <[email protected]>:
Quoted 9 lines · On Wed, 2 Nov 2022 11:25:16 -0700 you wrote:
__DECLARE_FLEX_ARRAYis defined ininclude/uapi/linux/stddef.hbut doesn't seem to be explicitly included frominclude/uapi/linux/in.h, which breaks BPF selftests builds (once we synclinux/stddef.hintotools/includedirectory in the next patch). Fix this by explicitly includinglinux/stddef.h.Given this affects BPF CI and bpf tree, targeting this for bpf tree.
[...]
Here is the summary with links:
- [bpf,1/2] net/ipv4: fix linux/in.h header dependencies
https://git.kernel.org/bpf/bpf/c/aec1dc972d27 - [bpf,2/2] tools headers uapi: pull in stddef.h to fix BPF selftests build in CI https://git.kernel.org/bpf/bpf/c/a778f5d46b62
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 14 lines · On 11/3/22 5:50 AM, [email protected] wrote:
Hello:
This series was applied to bpf/bpf.git (master)
by Daniel Borkmann <[email protected]>:Quoted 8 lines · On Wed, 2 Nov 2022 11:25:16 -0700 you wrote:
__DECLARE_FLEX_ARRAYis defined ininclude/uapi/linux/stddef.hbut doesn't seem to be explicitly included frominclude/uapi/linux/in.h, which breaks BPF selftests builds (once we synclinux/stddef.hintotools/includedirectory in the next patch). Fix this by explicitly includinglinux/stddef.h.Given this affects BPF CI and bpf tree, targeting this for bpf tree.
Quoted 7 lines
Quoted 1 line
[...]
Here is the summary with links:
- [bpf,1/2] net/ipv4: fixlinux/in.hheader dependencieshttps://git.kernel.org/bpf/bpf/c/aec1dc972d27 - [bpf,2/2] tools headers uapi: pull in stddef.h to fix BPF selftests build in CI https://git.kernel.org/bpf/bpf/c/a778f5d46b62
Can we put this patch set into bpf-next as well? Apparently we have the same issue in bpf-next.
Quoted 2 lines
You are awesome, thank you!
Quoted 20 lines · Yonghong Song
Quoted 16 lines · On 11/3/22 5:50 AM, [email protected] wrote:
Hello:
This series was applied to bpf/bpf.git (master)
by Daniel Borkmann <[email protected]>:Quoted 9 lines · On Wed, 2 Nov 2022 11:25:16 -0700 you wrote:
__DECLARE_FLEX_ARRAYis defined ininclude/uapi/linux/stddef.hbut doesn't seem to be explicitly included frominclude/uapi/linux/in.h, which breaks BPF selftests builds (once we synclinux/stddef.hintotools/includedirectory in the next patch). Fix this by explicitly includinglinux/stddef.h.Given this affects BPF CI and bpf tree, targeting this for bpf tree.
[...]
Quoted 9 lines
Quoted 5 lines
Here is the summary with links:
- [bpf,1/2] net/ipv4: fixlinux/in.hheader dependencieshttps://git.kernel.org/bpf/bpf/c/aec1dc972d27 - [bpf,2/2] tools headers uapi: pull in stddef.h to fix BPF selftests build in CI https://git.kernel.org/bpf/bpf/c/a778f5d46b62Can we put this patch set into bpf-next as well? Apparently we have the same issue in bpf-next.
Unfortunately we can't because they are already in bpf, and if we have them in bpf-next, they will cause merge conflicts. So I currently cherry-pick those two patches locally when compiling selftests. This should hopefully will be fixed soon and bpf and bpf-next will converge.
Quoted 2 lines
Quoted 2 lines
You are awesome, thank you!
Quoted 31 lines · Andrii Nakryiko
Quoted 20 lines · Yonghong Song
Quoted 16 lines · On 11/3/22 5:50 AM, [email protected] wrote:
Hello:
This series was applied to bpf/bpf.git (master)
by Daniel Borkmann <[email protected]>:Quoted 9 lines · On Wed, 2 Nov 2022 11:25:16 -0700 you wrote:
__DECLARE_FLEX_ARRAYis defined ininclude/uapi/linux/stddef.hbut doesn't seem to be explicitly included frominclude/uapi/linux/in.h, which breaks BPF selftests builds (once we synclinux/stddef.hintotools/includedirectory in the next patch). Fix this by explicitly includinglinux/stddef.h.Given this affects BPF CI and bpf tree, targeting this for bpf tree.
[...]
Quoted 9 lines
Quoted 5 lines
Here is the summary with links:
- [bpf,1/2] net/ipv4: fixlinux/in.hheader dependencies
https://git.kernel.org/bpf/bpf/c/aec1dc972d27
- [bpf,2/2] tools headers uapi: pull instddef.hto fix BPF selftests build in CI
https://git.kernel.org/bpf/bpf/c/a778f5d46b62Can we put this patch set into bpf-next as well? Apparently we have the same issue in bpf-next.
Quoted 5 lines
Unfortunately we can't because they are already in bpf, and if we have them in bpf-next, they will cause merge conflicts. So I currently cherry-pick those two patches locally when compiling selftests. This should hopefully will be fixed soon and bpf and bpf-next will converge.
Thanks. This should be fine. I guess most people will do the same thing (cherry-pick locally).
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
You are awesome, thank you!