Re: [PATCH net-next 3/7] bpf: add array type of eBPF maps

2014-11-04 Thread Alexei Starovoitov
On Tue, Nov 4, 2014 at 1:58 AM, Daniel Borkmann wrote: >> + >> + memcpy(array->value + array->elem_size * index, value, >> array->elem_size); > > What would protect this from concurrent updates? nothing. that's what I meant in commit log: - map_update_elem() replaces elements in an

Re: [PATCH net-next 3/7] bpf: add array type of eBPF maps

2014-11-04 Thread Daniel Borkmann
On 11/04/2014 03:54 AM, Alexei Starovoitov wrote: add new map type BPF_MAP_TYPE_ARRAY and its implementation - optimized for fastest possible lookup() . in the future verifier/JIT may recognize lookup() with constant key and optimize it into constant pointer. Can optimize non-constant

Re: [PATCH net-next 3/7] bpf: add array type of eBPF maps

2014-11-04 Thread Daniel Borkmann
On 11/04/2014 03:54 AM, Alexei Starovoitov wrote: add new map type BPF_MAP_TYPE_ARRAY and its implementation - optimized for fastest possible lookup() . in the future verifier/JIT may recognize lookup() with constant key and optimize it into constant pointer. Can optimize non-constant

Re: [PATCH net-next 3/7] bpf: add array type of eBPF maps

2014-11-04 Thread Alexei Starovoitov
On Tue, Nov 4, 2014 at 1:58 AM, Daniel Borkmann dbork...@redhat.com wrote: + + memcpy(array-value + array-elem_size * index, value, array-elem_size); What would protect this from concurrent updates? nothing. that's what I meant in commit log: - map_update_elem() replaces elements in

[PATCH net-next 3/7] bpf: add array type of eBPF maps

2014-11-03 Thread Alexei Starovoitov
add new map type BPF_MAP_TYPE_ARRAY and its implementation - optimized for fastest possible lookup() . in the future verifier/JIT may recognize lookup() with constant key and optimize it into constant pointer. Can optimize non-constant key into direct pointer arithmetic as well, since

[PATCH net-next 3/7] bpf: add array type of eBPF maps

2014-11-03 Thread Alexei Starovoitov
add new map type BPF_MAP_TYPE_ARRAY and its implementation - optimized for fastest possible lookup() . in the future verifier/JIT may recognize lookup() with constant key and optimize it into constant pointer. Can optimize non-constant key into direct pointer arithmetic as well, since