Skip to contentSkip to conversation

net/ipv4: fix linux/in.h header dependencies

PATCH Applied Andrii Nakryiko 4 participants 6 messages Nov 2, 2022 – Nov 8, 2022

Subsystems (3)
lore
Share & tools
lore

Andrii Nakryiko

author maintainer
#0 lore raw

PATCH 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.

Cc Jakub Kicinski <[email protected]>
Cc Gustavo A. R. Silva <[email protected]>
Fixes 5854a09b4957 ("net/ipv4: Use __DECLARE_FLEX_ARRAY() helper")
---
 include/uapi/linux/in.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/in.h +1 -0
index f243ce665f74..07a4cb149305 100644
@@ -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
author maintainer
#1 lore raw

PATCH 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.h

This 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

Cc Jakub Kicinski <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Fixes 036b8f5b8970 ("tools headers uapi: Update linux/in.h copy")
---
 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
index f243ce665f74..07a4cb149305 100644
@@ -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
#2 lore raw
In reply to Andrii Nakryiko
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_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.

[...]

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
#3 lore raw
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_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.

Quoted 7 lines
Quoted 1 line

[...]

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

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!

#4 lore raw
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_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.

[...]

Quoted 9 lines
Quoted 5 lines

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

Can 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!

#5 lore raw
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_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.

[...]

Quoted 9 lines
Quoted 5 lines

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

Can 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!