diff options
author | Anton Protopopov <aspsk@isovalent.com> | 2024-03-26 10:17:42 +0000 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2024-03-27 16:33:10 +0100 |
commit | 2a720ccf308cd5cb1b77e587bf42448471a44da6 (patch) | |
tree | 7788c6b854f763aa643106437b89490e0342d8f7 | |
parent | 1ea0f255a3fe862224bc36ddcaa9b8b3375df0f8 (diff) | |
download | bpf-next-2a720ccf308cd5cb1b77e587bf42448471a44da6.tar.gz |
bpf: Add a check for struct bpf_fib_lookup size
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
-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 1205dd777dc2f..786d792ac8161 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -87,6 +87,9 @@ #include "dev.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, const struct bpf_prog *prog); |