bpf: Sync include/uapi/linux/bpf.h with tools/include/uapi/linux/bpf.h
PATCH 1/1 bpf: Sync include/uapi/linux/bpf.h with tools/include/uapi/linux/bpf.h
Commit 94dfc73e7cf4 ("treewide: uapi: Replace zero-length arrays with flexible-array members") modified bpf_lpm_trie_key struct's data member in include/uapi/linux/bpf.h, but didn't make the same change in tools dir's copy. Propagate it over and fix comment indentation as well.
This is a nonfunctional change.
--- include/uapi/linux/bpf.h | 2 +- tools/include/uapi/linux/bpf.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/bpf.h +1 -1
@@ -79,7 +79,7 @@ struct bpf_insn {/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */ struct bpf_lpm_trie_key {__u32 prefixlen;/* up to 32 for AF_INET, 128 for AF_INET6 */ -__u8 data[];/* Arbitrary size */ +__u8 data[];/* Arbitrary size */ };struct bpf_cgroup_storage_key {
tools/include/uapi/linux/bpf.h +1 -1
@@ -79,7 +79,7 @@ struct bpf_insn {/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */ struct bpf_lpm_trie_key {__u32 prefixlen;/* up to 32 for AF_INET, 128 for AF_INET6 */ -__u8 data[0 ];/* Arbitrary size */ +__u8 data[];/* Arbitrary size */ };struct bpf_cgroup_storage_key {
Signature · 1 line
2.30.2
Daniel Borkmann
maintainer[ +Gustavo ]
Quoted 8 lines · Dave Marchevsky
Commit
94dfc73e7cf4("treewide: uapi: Replace zero-length arrays with flexible-array members") modifiedbpf_lpm_trie_keystruct's data member ininclude/uapi/linux/bpf.h, but didn't make the same change in tools dir's copy. Propagate it over and fix comment indentation as well.This is a nonfunctional change.
Signed-off-by Dave Marchevsky <[email protected]>
Gustavo, 94dfc73e7cf4 ("treewide: uapi: Replace zero-length arrays with flexible-array members") breaks BPF when copied from include/uapi/linux/bpf.h to tools/include/uapi/linux/bpf.h :
CI: https://github.com/kernel-patches/bpf/runs/7885234999?check_suite_focus=true
[...]
CLNG-BPF [test_maps] map_ptr_kern.o
CLNG-BPF [test_maps] btf__core_reloc_arrays___diff_arr_val_sz.o
CLNG-BPF [test_maps] test_bpf_cookie.o
progs/map_ptr_kern.c:314:26: error: field 'trie_key' with variable sized type 'struct bpf_lpm_trie_key' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
struct bpf_lpm_trie_key trie_key;
^
CLNG-BPF [test_maps] btf__core_reloc_type_based___diff.o 1 error generated.
make: *** [Makefile:521: /tmp/runner/work/bpf/bpf/tools/testing/selftests/bpf/map_ptr_kern.o] Error 1
make: *** Waiting for unfinished jobs....
If you look at the selftest tools/testing/selftests/bpf/progs/map_ptr_kern.c +314 :
/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
struct bpf_lpm_trie_key {
__u32 prefixlen; /* up to 32 for AF_INET, 128 for AF_INET6 */
__u8 data[]; /* Arbitrary size */
};
struct lpm_key {
struct bpf_lpm_trie_key trie_key;
__u32 data;
};Did you try to compile the tree (or selftests) with LLVM? I doubt the UX will be nice if everyone now has to add -Wno-gnu-variable-sized-type-not-at-end ..
Quoted 32 lines
--- include/uapi/linux/bpf.h | 2 +- tools/include/uapi/linux/bpf.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)include/uapi/linux/bpf.h +1
-1@@ -79,7 +79,7 @@ struct bpf_insn {/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */ struct bpf_lpm_trie_key {__u32 prefixlen;/* up to 32 for AF_INET, 128 for AF_INET6 */ -__u8 data[];/* Arbitrary size */ +__u8 data[];/* Arbitrary size */ };struct bpf_cgroup_storage_key {tools/include/uapi/linux/bpf.h +1
-1@@ -79,7 +79,7 @@ struct bpf_insn {/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */ struct bpf_lpm_trie_key {__u32 prefixlen;/* up to 32 for AF_INET, 128 for AF_INET6 */ -__u8 data[0 ];/* Arbitrary size */ +__u8 data[];/* Arbitrary size */ };struct bpf_cgroup_storage_key {
Daniel Borkmann
maintainerQuoted 37 lines · Daniel Borkmann
[ +Gustavo ]
Quoted 8 lines · Dave Marchevsky
Commit
94dfc73e7cf4("treewide: uapi: Replace zero-length arrays with flexible-array members") modifiedbpf_lpm_trie_keystruct's data member ininclude/uapi/linux/bpf.h, but didn't make the same change in tools dir's copy. Propagate it over and fix comment indentation as well.This is a nonfunctional change.
Signed-off-by Dave Marchevsky <[email protected]>Gustavo,
94dfc73e7cf4("treewide: uapi: Replace zero-length arrays with flexible-array members") breaks BPF when copied frominclude/uapi/linux/bpf.htotools/include/uapi/linux/bpf.h:CI: https://github.com/kernel-patches/bpf/runs/7885234999?check_suite_focus=true
[...]
CLNG-BPF [test_maps] map_ptr_kern.o
CLNG-BPF [test_maps] btf__core_reloc_arrays___diff_arr_val_sz.o
CLNG-BPF [test_maps] test_bpf_cookie.o
progs/map_ptr_kern.c:314:26: error: field 'trie_key' with variable sized type 'structbpf_lpm_trie_key' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end] structbpf_lpm_trie_keytrie_key;
^
CLNG-BPF [test_maps] btf__core_reloc_type_based___diff.o
1 error generated.
make: *** [Makefile:521:/tmp/runner/work/bpf/bpf/tools/testing/selftests/bpf/map_ptr_kern.o] Error 1
make: *** Waiting for unfinished jobs....If you look at the selftest
tools/testing/selftests/bpf/progs/map_ptr_kern.c+314 :/* Key of an a
BPF_MAP_TYPE_LPM_TRIEentry */
structbpf_lpm_trie_key{
__u32 prefixlen; /* up to 32 forAF_INET, 128 forAF_INET6*/ __u8 data[]; /* Arbitrary size */
};
Quoted 7 lines
struct
lpm_key{
structbpf_lpm_trie_keytrie_key;
__u32data;
};Did you try to compile the tree (or selftests) with LLVM? I doubt the UX will be nice if everyone now has to add -Wno-gnu-variable-sized-type-not-at-end ..
Undone here until a different workaround can be found (affects both bpf and bpf-next):
Thanks,
Daniel