bpf: Add missing map_get_next_key method to bloom filter map
Subsystems (3)
PATCH 1/1 bpf: Add missing map_get_next_key method to bloom filter map
From: Eric Dumazet <[email protected]>
It appears map_get_next_key() method is mandatory,
as syzbot is able to trigger a NULL deref in map_get_next_key().
--- kernel/bpf/bloom_filter.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/bpf/bloom_filter.c +7 -0
@@ -82,6 +82,12 @@ static int bloom_map_delete_elem(struct bpf_map *map, void *value)return -EOPNOTSUPP ; } +static int bloom_get_next_key (struct bpf_map *map,void *key, +void *next_key) +{ +return -ENOTSUPP ; +} +static struct bpf_map *bloom_map_alloc (union bpf_attr *attr) {u32 bitset_bytes, bitset_mask, nr_hash_funcs, nr_bits;
@@ -201,4 +207,5 @@ const struct bpf_map_ops bloom_filter_map_ops = { .map_check_btf = bloom_map_check_btf, .map_btf_name = "bpf_bloom_filter", .map_btf_id = &bpf_bloom_map_btf_id, + .map_get_next_key = bloom_get_next_key, };
Signature · 1 line
2.34.1.448.ga2b2bfdf31-goog
Daniel Borkmann
maintainerHi Eric, [ +Joanne, ]
Quoted 10 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
It appears
map_get_next_key()method is mandatory,
as syzbot is able to trigger a NULL deref inmap_get_next_key().Fixes 9330986c0300 ("bpf: Add bloom filter map implementation")Reported-by syzbot <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Cc Alexei Starovoitov <[email protected]>Cc Yonghong Song <[email protected]>
Thanks for your patch, this has recently been fixed:
I'm not quite sure why it was applied to bpf-next instead of bpf (maybe assumption was that there would be no rc8 anymore), but I'd expect it to land in Linus' tree once merge window opens up on 9th Jan. In that case stable team would have to pick it up for 5.16.
Thanks,
Daniel
Quoted 15 lines · Daniel Borkmann
Hi Eric, [ +Joanne, ]
Quoted 10 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
It appears
map_get_next_key()method is mandatory,
as syzbot is able to trigger a NULL deref inmap_get_next_key().Fixes 9330986c0300 ("bpf: Add bloom filter map implementation")Reported-by syzbot <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Cc Alexei Starovoitov <[email protected]>Cc Yonghong Song <[email protected]>
Quoted 8 lines
Thanks for your patch, this has recently been fixed:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=3ccdcee28415c4226de05438b4d89eb5514edf73I'm not quite sure why it was applied to bpf-next instead of bpf (maybe assumption was that there would be no rc8 anymore), but I'd expect it to land in Linus' tree once merge window opens up on 9th Jan. In that case stable team would have to pick it up for 5.16.
Ah, this is why I could not find the fix in bpf or net tree, thanks.
Quoted 2 lines
Thanks,
Daniel