* [PATCH bpf 1/2] net/ipv4: fix linux/in.h header dependencies
@ 2022-11-02 18:25 Andrii Nakryiko
2022-11-02 18:25 ` [PATCH bpf 2/2] tools headers uapi: pull in stddef.h to fix BPF selftests build in CI Andrii Nakryiko
2022-11-03 12:50 ` [PATCH bpf 1/2] net/ipv4: fix linux/in.h header dependencies patchwork-bot+netdevbpf
0 siblings, 2 replies; 6+ messages in thread
From: Andrii Nakryiko @ 2022-11-02 18:25 UTC (permalink / raw)
To: bpf, ast, daniel, netdev, kuba; +Cc: andrii, kernel-team, Gustavo A . R . Silva
__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 <kuba@kernel.org>
Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
Fixes: 5854a09b4957 ("net/ipv4: Use __DECLARE_FLEX_ARRAY() helper")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
include/uapi/linux/in.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h
index f243ce665f74..07a4cb149305 100644
--- a/include/uapi/linux/in.h
+++ b/include/uapi/linux/in.h
@@ -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>
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH bpf 2/2] tools headers uapi: pull in stddef.h to fix BPF selftests build in CI 2022-11-02 18:25 [PATCH bpf 1/2] net/ipv4: fix linux/in.h header dependencies Andrii Nakryiko @ 2022-11-02 18:25 ` Andrii Nakryiko 2022-11-03 12:50 ` [PATCH bpf 1/2] net/ipv4: fix linux/in.h header dependencies patchwork-bot+netdevbpf 1 sibling, 0 replies; 6+ messages in thread From: Andrii Nakryiko @ 2022-11-02 18:25 UTC (permalink / raw) To: bpf, ast, daniel, netdev, kuba Cc: andrii, kernel-team, Gustavo A . R . Silva, Arnaldo Carvalho de Melo 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 <kuba@kernel.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Fixes: 036b8f5b8970 ("tools headers uapi: Update linux/in.h copy") Signed-off-by: Andrii Nakryiko <andrii@kernel.org> --- 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 diff --git a/tools/include/uapi/linux/in.h b/tools/include/uapi/linux/in.h index f243ce665f74..07a4cb149305 100644 --- a/tools/include/uapi/linux/in.h +++ b/tools/include/uapi/linux/in.h @@ -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> diff --git a/tools/include/uapi/linux/stddef.h b/tools/include/uapi/linux/stddef.h new file mode 100644 index 000000000000..bb6ea517efb5 --- /dev/null +++ b/tools/include/uapi/linux/stddef.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _LINUX_STDDEF_H +#define _LINUX_STDDEF_H + + + +#ifndef __always_inline +#define __always_inline __inline__ +#endif + +/** + * __struct_group() - Create a mirrored named and anonyomous struct + * + * @TAG: The tag name for the named sub-struct (usually empty) + * @NAME: The identifier name of the mirrored sub-struct + * @ATTRS: Any struct attributes (usually empty) + * @MEMBERS: The member declarations for the mirrored structs + * + * Used to create an anonymous union of two structs with identical layout + * and size: one anonymous and one named. The former's members can be used + * normally without sub-struct naming, and the latter can be used to + * reason about the start, end, and size of the group of struct members. + * The named struct can also be explicitly tagged for layer reuse, as well + * as both having struct attributes appended. + */ +#define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \ + union { \ + struct { MEMBERS } ATTRS; \ + struct TAG { MEMBERS } ATTRS NAME; \ + } + +/** + * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union + * + * @TYPE: The type of each flexible array element + * @NAME: The name of the flexible array member + * + * In order to have a flexible array member in a union or alone in a + * struct, it needs to be wrapped in an anonymous struct with at least 1 + * named member, but that member can be empty. + */ +#define __DECLARE_FLEX_ARRAY(TYPE, NAME) \ + struct { \ + struct { } __empty_ ## NAME; \ + TYPE NAME[]; \ + } +#endif -- 2.30.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH bpf 1/2] net/ipv4: fix linux/in.h header dependencies 2022-11-02 18:25 [PATCH bpf 1/2] net/ipv4: fix linux/in.h header dependencies Andrii Nakryiko 2022-11-02 18:25 ` [PATCH bpf 2/2] tools headers uapi: pull in stddef.h to fix BPF selftests build in CI Andrii Nakryiko @ 2022-11-03 12:50 ` patchwork-bot+netdevbpf 2022-11-03 16:17 ` Yonghong Song 1 sibling, 1 reply; 6+ messages in thread From: patchwork-bot+netdevbpf @ 2022-11-03 12:50 UTC (permalink / raw) To: Andrii Nakryiko; +Cc: bpf, ast, daniel, netdev, kuba, kernel-team, gustavoars Hello: This series was applied to bpf/bpf.git (master) by Daniel Borkmann <daniel@iogearbox.net>: 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! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf 1/2] net/ipv4: fix linux/in.h header dependencies 2022-11-03 12:50 ` [PATCH bpf 1/2] net/ipv4: fix linux/in.h header dependencies patchwork-bot+netdevbpf @ 2022-11-03 16:17 ` Yonghong Song 2022-11-08 0:56 ` Andrii Nakryiko 0 siblings, 1 reply; 6+ messages in thread From: Yonghong Song @ 2022-11-03 16:17 UTC (permalink / raw) To: patchwork-bot+netdevbpf, Andrii Nakryiko Cc: bpf, ast, daniel, netdev, kuba, kernel-team, gustavoars On 11/3/22 5:50 AM, patchwork-bot+netdevbpf@kernel.org wrote: > Hello: > > This series was applied to bpf/bpf.git (master) > by Daniel Borkmann <daniel@iogearbox.net>: > > 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 Can we put this patch set into bpf-next as well? Apparently we have the same issue in bpf-next. > > You are awesome, thank you! ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf 1/2] net/ipv4: fix linux/in.h header dependencies 2022-11-03 16:17 ` Yonghong Song @ 2022-11-08 0:56 ` Andrii Nakryiko 2022-11-08 1:08 ` Yonghong Song 0 siblings, 1 reply; 6+ messages in thread From: Andrii Nakryiko @ 2022-11-08 0:56 UTC (permalink / raw) To: Yonghong Song Cc: patchwork-bot+netdevbpf, Andrii Nakryiko, bpf, ast, daniel, netdev, kuba, kernel-team, gustavoars On Thu, Nov 3, 2022 at 9:18 AM Yonghong Song <yhs@meta.com> wrote: > > > > On 11/3/22 5:50 AM, patchwork-bot+netdevbpf@kernel.org wrote: > > Hello: > > > > This series was applied to bpf/bpf.git (master) > > by Daniel Borkmann <daniel@iogearbox.net>: > > > > 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 > > 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. > > > > You are awesome, thank you! ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf 1/2] net/ipv4: fix linux/in.h header dependencies 2022-11-08 0:56 ` Andrii Nakryiko @ 2022-11-08 1:08 ` Yonghong Song 0 siblings, 0 replies; 6+ messages in thread From: Yonghong Song @ 2022-11-08 1:08 UTC (permalink / raw) To: Andrii Nakryiko Cc: patchwork-bot+netdevbpf, Andrii Nakryiko, bpf, ast, daniel, netdev, kuba, kernel-team, gustavoars On 11/7/22 4:56 PM, Andrii Nakryiko wrote: > On Thu, Nov 3, 2022 at 9:18 AM Yonghong Song <yhs@meta.com> wrote: >> >> >> >> On 11/3/22 5:50 AM, patchwork-bot+netdevbpf@kernel.org wrote: >>> Hello: >>> >>> This series was applied to bpf/bpf.git (master) >>> by Daniel Borkmann <daniel@iogearbox.net>: >>> >>> 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 >> >> 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. Thanks. This should be fine. I guess most people will do the same thing (cherry-pick locally). > >>> >>> You are awesome, thank you! ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-11-08 1:08 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-11-02 18:25 [PATCH bpf 1/2] net/ipv4: fix linux/in.h header dependencies Andrii Nakryiko 2022-11-02 18:25 ` [PATCH bpf 2/2] tools headers uapi: pull in stddef.h to fix BPF selftests build in CI Andrii Nakryiko 2022-11-03 12:50 ` [PATCH bpf 1/2] net/ipv4: fix linux/in.h header dependencies patchwork-bot+netdevbpf 2022-11-03 16:17 ` Yonghong Song 2022-11-08 0:56 ` Andrii Nakryiko 2022-11-08 1:08 ` Yonghong Song
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox