diff options
author | Martin KaFai Lau <kafai@fb.com> | 2020-08-27 18:18:13 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-08-28 15:41:30 +0200 |
commit | 134fede4eecfcbe7900e789f625fa6f9c3a8cd0e (patch) | |
tree | ac0ff7502836e57adf3e1d442dd6814a08e5a8b4 /kernel/bpf/map_in_map.c | |
parent | f4d05259213ff1e91f767c91dcab455f68308fac (diff) | |
download | linux-134fede4eecfcbe7900e789f625fa6f9c3a8cd0e.tar.gz linux-134fede4eecfcbe7900e789f625fa6f9c3a8cd0e.tar.bz2 linux-134fede4eecfcbe7900e789f625fa6f9c3a8cd0e.zip |
bpf: Relax max_entries check for most of the inner map types
Most of the maps do not use max_entries during verification time.
Thus, those map_meta_equal() do not need to enforce max_entries
when it is inserted as an inner map during runtime. The max_entries
check is removed from the default implementation bpf_map_meta_equal().
The prog_array_map and xsk_map are exception. Its map_gen_lookup
uses max_entries to generate inline lookup code. Thus, they will
implement its own map_meta_equal() to enforce max_entries.
Since there are only two cases now, the max_entries check
is not refactored and stays in its own .c file.
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200828011813.1970516-1-kafai@fb.com
Diffstat (limited to 'kernel/bpf/map_in_map.c')
-rw-r--r-- | kernel/bpf/map_in_map.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/bpf/map_in_map.c b/kernel/bpf/map_in_map.c index e97a22dd3232..39ab0b68cade 100644 --- a/kernel/bpf/map_in_map.c +++ b/kernel/bpf/map_in_map.c @@ -75,8 +75,7 @@ bool bpf_map_meta_equal(const struct bpf_map *meta0, return meta0->map_type == meta1->map_type && meta0->key_size == meta1->key_size && meta0->value_size == meta1->value_size && - meta0->map_flags == meta1->map_flags && - meta0->max_entries == meta1->max_entries; + meta0->map_flags == meta1->map_flags; } void *bpf_map_fd_get_ptr(struct bpf_map *map, |