OpenCloudOS-Kernel/include
Daniel Borkmann 3024d95a4c bpf: Partially revert flexible-array member replacement
Partially revert 94dfc73e7c ("treewide: uapi: Replace zero-length arrays
with flexible-array members") given it breaks BPF UAPI.

For example, BPF CI run reveals build breakage under LLVM:

  [...]
    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....
  [...]

Typical usage of the bpf_lpm_trie_key is that the struct gets embedded into
a user defined key for the LPM BPF map, from the selftest example:

  struct bpf_lpm_trie_key {                 <-- UAPI exported struct
         __u32   prefixlen;
         __u8    data[];
  };

  struct lpm_key {                          <-- BPF program defined struct
         struct bpf_lpm_trie_key trie_key;
         __u32 data;
  };

Undo this for BPF until a different solution can be found. It's the only flexible-
array member case in the UAPI header.

This was discovered in BPF CI after Dave reported that the include/uapi/linux/bpf.h
header was out of sync with tools/include/uapi/linux/bpf.h after 94dfc73e7c. And
the subsequent sync attempt failed CI.

Fixes: 94dfc73e7c ("treewide: uapi: Replace zero-length arrays with flexible-array members")
Reported-by: Dave Marchevsky <davemarchevsky@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/bpf/22aebc88-da67-f086-e620-dd4a16e2bc69@iogearbox.net
2022-08-17 23:45:47 +02:00
..
acpi Merge branch 'acpi-properties' 2022-08-11 19:21:03 +02:00
asm-generic Bitmap patches for v6.0-rc1 2022-08-07 17:52:35 -07:00
clocksource - Add the missing DT bindings for the MTU nomadik timer (Linus 2022-07-28 12:33:34 +02:00
crypto for-5.20/block-2022-08-04 2022-08-04 20:00:14 -07:00
drm Driver uAPI changes: 2022-07-22 15:51:31 +10:00
dt-bindings Pin control bulk changes for v6.0: 2022-08-10 11:01:44 -07:00
keys
kunit
kvm KVM: arm64: vgic: Consolidate userspace access for base address setting 2022-07-17 11:55:33 +01:00
linux Including fixes from bluetooth, bpf, can and netfilter. 2022-08-11 13:45:37 -07:00
math-emu
media SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
memory
misc
net Including fixes from bluetooth, bpf, can and netfilter. 2022-08-11 13:45:37 -07:00
pcmcia
ras mm, hwpoison: enable memory error handling on 1GB hugepage 2022-08-08 18:06:44 -07:00
rdma dma-mapping updates 2022-08-06 10:56:45 -07:00
rv Documentation/rv: Add deterministic automata monitor synthesis documentation 2022-07-30 14:01:29 -04:00
scsi dma-mapping updates 2022-08-06 10:56:45 -07:00
soc Char / Misc driver changes for 6.0-rc1 2022-08-04 11:05:48 -07:00
sound ASoC: More updates for v5.20 2022-08-01 15:26:40 +02:00
target
trace * Xen timer fixes 2022-08-11 12:10:08 -07:00
uapi bpf: Partially revert flexible-array member replacement 2022-08-17 23:45:47 +02:00
ufs
vdso
video
xen xen: don't require virtio with grants for non-PV guests 2022-08-01 07:43:03 +02:00