Re: [PATCH bpf-next v2 4/6] bpf: Introduce bpf_per_cpu_ptr()

2020-09-14 Thread Andrii Nakryiko
On Sun, Sep 13, 2020 at 10:01 PM Hao Luo wrote: > > Thanks for review, Andrii. > > One question, should I add bpf_{per, this}_cpu_ptr() to the > bpf_base_func_proto() in kernel/bpf/helpers.c? Yes, probably, but given it allows poking at kernel memory, it probably needs to be guarded by

Re: [PATCH bpf-next v2 4/6] bpf: Introduce bpf_per_cpu_ptr()

2020-09-13 Thread Hao Luo
Thanks for review, Andrii. One question, should I add bpf_{per, this}_cpu_ptr() to the bpf_base_func_proto() in kernel/bpf/helpers.c? On Fri, Sep 4, 2020 at 1:04 PM Andrii Nakryiko wrote: > > On Thu, Sep 3, 2020 at 3:35 PM Hao Luo wrote: > > > > Add bpf_per_cpu_ptr() to help bpf programs

Re: [PATCH bpf-next v2 4/6] bpf: Introduce bpf_per_cpu_ptr()

2020-09-04 Thread Andrii Nakryiko
On Thu, Sep 3, 2020 at 3:35 PM Hao Luo wrote: > > Add bpf_per_cpu_ptr() to help bpf programs access percpu vars. > bpf_per_cpu_ptr() has the same semantic as per_cpu_ptr() in the kernel > except that it may return NULL. This happens when the cpu parameter is > out of range. So the caller must

[PATCH bpf-next v2 4/6] bpf: Introduce bpf_per_cpu_ptr()

2020-09-03 Thread Hao Luo
Add bpf_per_cpu_ptr() to help bpf programs access percpu vars. bpf_per_cpu_ptr() has the same semantic as per_cpu_ptr() in the kernel except that it may return NULL. This happens when the cpu parameter is out of range. So the caller must check the returned value. Acked-by: Andrii Nakryiko