Re: [PATCH net-next 3/9] bpf: pre-allocate hash map elements

2016-03-07 Thread Alexei Starovoitov
On 3/7/16 3:08 AM, Daniel Borkmann wrote: On 03/07/2016 02:58 AM, Alexei Starovoitov wrote: [...] --- include/linux/bpf.h | 1 + include/uapi/linux/bpf.h | 3 + kernel/bpf/hashtab.c | 264 ++- kernel/bpf/syscall.c | 2 +- 4 fil

Re: [PATCH net-next 3/9] bpf: pre-allocate hash map elements

2016-03-07 Thread Daniel Borkmann
On 03/07/2016 02:58 AM, Alexei Starovoitov wrote: [...] --- include/linux/bpf.h | 1 + include/uapi/linux/bpf.h | 3 + kernel/bpf/hashtab.c | 264 ++- kernel/bpf/syscall.c | 2 +- 4 files changed, 196 insertions(+), 74 deletions

[PATCH net-next 3/9] bpf: pre-allocate hash map elements

2016-03-06 Thread Alexei Starovoitov
If kprobe is placed on spin_unlock then calling kmalloc/kfree from bpf programs is not safe, since the following dead lock is possible: kfree->spin_lock(kmem_cache_node->lock)...spin_unlock->kprobe-> bpf_prog->map_update->kmalloc->spin_lock(of the same kmem_cache_node->lock) and deadlocks. The fol