Skip to content

Commit

Permalink
bpf: add a check for struct bpf_fib_lookup size
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
aspsk committed Mar 25, 2024
1 parent 6d761da commit 7cd3685
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/core/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 7cd3685

Please sign in to comment.