Re: [PATCH bpf-next v7 2/5] bpf: Expose bpf_get_socket_cookie to tracing programs

2021-02-11 Thread Alexei Starovoitov
On Wed, Feb 10, 2021 at 3:14 AM Florent Revest wrote: > > +BPF_CALL_1(bpf_get_socket_ptr_cookie, struct sock *, sk) > +{ > + return sk ? sock_gen_cookie(sk) : 0; > +} > + > +const struct bpf_func_proto bpf_get_socket_ptr_cookie_proto = { > + .func = bpf_get_socket_ptr_cookie,

Re: [PATCH bpf-next v7 2/5] bpf: Expose bpf_get_socket_cookie to tracing programs

2021-02-10 Thread Florent Revest
On Wed, Feb 10, 2021 at 8:52 PM Andrii Nakryiko wrote: > > On Wed, Feb 10, 2021 at 3:14 AM Florent Revest wrote: > > > > This needs a new helper that: > > - can work in a sleepable context (using sock_gen_cookie) > > - takes a struct sock pointer and checks that it's not NULL > > > > Signed-off-b

Re: [PATCH bpf-next v7 2/5] bpf: Expose bpf_get_socket_cookie to tracing programs

2021-02-10 Thread Andrii Nakryiko
On Wed, Feb 10, 2021 at 3:14 AM Florent Revest wrote: > > This needs a new helper that: > - can work in a sleepable context (using sock_gen_cookie) > - takes a struct sock pointer and checks that it's not NULL > > Signed-off-by: Florent Revest > Acked-by: KP Singh > --- It's customary to send c

[PATCH bpf-next v7 2/5] bpf: Expose bpf_get_socket_cookie to tracing programs

2021-02-10 Thread Florent Revest
This needs a new helper that: - can work in a sleepable context (using sock_gen_cookie) - takes a struct sock pointer and checks that it's not NULL Signed-off-by: Florent Revest Acked-by: KP Singh --- include/linux/bpf.h| 1 + include/uapi/linux/bpf.h | 8 kernel/tr