Skip to content

Commit dc009e0

Browse files
aspskEvilAnsh
authored andcommitted
UPSTREAM: bpf: Add a check for struct bpf_fib_lookup size
[ Upstream commit 59b418c7063d30e0a3e1f592d47df096db83185c ] The struct bpf_fib_lookup should not grow outside of its 64 bytes. Add a static assert to validate this. Suggested-by: David Ahern <dsahern@kernel.org> Change-Id: I65c2aaa9ae8c055a2ee11af346ee73684a9496d7 Signed-off-by: Anton Protopopov <aspsk@isovalent.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20240326101742.17421-4-aspsk@isovalent.com Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Naveen <133593113+elohim-etz@users.noreply.github.com>
1 parent 94064f4 commit dc009e0

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

net/core/filter.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@
8181
#include <linux/btf_ids.h>
8282
#include <net/tls.h>
8383

84+
/* Keep the struct bpf_fib_lookup small so that it fits into a cacheline */
85+
static_assert(sizeof(struct bpf_fib_lookup) == 64, "struct bpf_fib_lookup size check");
86+
8487
static const struct bpf_func_proto *
8588
bpf_sk_base_func_proto(enum bpf_func_id func_id);
8689

0 commit comments

Comments
 (0)