diff options
| author | Anton Protopopov <aspsk@isovalent.com> | 2024-03-26 10:17:42 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-07-05 09:31:48 +0200 |
| commit | 5bcb9cf62f623c5f63cfa686f681dd5032458173 (patch) | |
| tree | a24a19037409dec9836c3f2134c4604807866bf9 /net | |
| parent | cc33a7a2f1abf712212140a5725803c857417665 (diff) | |
| download | linux-5bcb9cf62f623c5f63cfa686f681dd5032458173.tar.gz linux-5bcb9cf62f623c5f63cfa686f681dd5032458173.tar.bz2 linux-5bcb9cf62f623c5f63cfa686f681dd5032458173.zip | |
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>
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>
Diffstat (limited to 'net')
| -rw-r--r-- | net/core/filter.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/filter.c b/net/core/filter.c index 7a0741391353..dc89c3424718 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -82,6 +82,9 @@ #include <net/mptcp.h> #include <net/netfilter/nf_conntrack_bpf.h> +/* Keep the struct bpf_fib_lookup small so that it fits into a cacheline */ +static_assert(sizeof(struct bpf_fib_lookup) == 64, "struct bpf_fib_lookup size check"); + static const struct bpf_func_proto * bpf_sk_base_func_proto(enum bpf_func_id func_id); |
