Messages in this thread | | | Date | Thu, 9 Feb 2023 09:48:18 -0800 | From | Kees Cook <> | Subject | Re: [PATCH] bpf: Replace bpf_lpm_trie_key 0-length array with flexible array |
| |
On Thu, Feb 09, 2023 at 08:55:23AM -0800, Alexei Starovoitov wrote: > On Thu, Feb 9, 2023 at 8:36 AM Kees Cook <keescook@chromium.org> wrote: > > This approach is, perhaps, the best way to go? Besides the selftest, > > what things in userspace consumes struct bpf_lpm_trie_key? > > Plenty of bpf progs use it: > https://github.com/cilium/cilium/blob/master/bpf/lib/common.h#L352
Thanks for the pointer! Yeah, it seems the "data" member is not directly used, but is expected to be there for static initializers and offsetof() use. For example:
cilium: struct egress_gw_policy_key in_key = { .lpm_key = { 32 + 24, {} }, .saddr = CLIENT_IP, .daddr = EXTERNAL_SVC_IP & 0Xffffff, };
systemd: ipv6_map_fd = bpf_map_new( BPF_MAP_TYPE_LPM_TRIE, offsetof(struct bpf_lpm_trie_key, data) + sizeof(uint32_t)*4, sizeof(uint64_t), ...
All the others searches in Debian I could find were just copies of UAPI headers: https://codesearch.debian.net/search?q=struct+bpf_lpm_trie_key&literal=1&perpkg=1
-- Kees Cook
| |