Re: [PATCH net] bpf: fix hashmap extra_elems logic

2017-03-22 Thread David Miller
From: Alexei Starovoitov Date: Tue, 21 Mar 2017 19:05:04 -0700 > In both kmalloc and prealloc mode the bpf_map_update_elem() is using > per-cpu extra_elems to do atomic update when the map is full. > There are two issues with it. The logic can be misused, since it allows >

[PATCH net] bpf: fix hashmap extra_elems logic

2017-03-21 Thread Alexei Starovoitov
In both kmalloc and prealloc mode the bpf_map_update_elem() is using per-cpu extra_elems to do atomic update when the map is full. There are two issues with it. The logic can be misused, since it allows max_entries+num_cpus elements to be present in the map. And alloc_extra_elems() at map creation