Re: [PATCH bpf-next v3 5/6] bpf: Add an iterator selftest for bpf_sk_storage_get

2020-11-27 Thread Florent Revest
On Thu, 2020-11-26 at 23:00 -0800, Yonghong Song wrote: > On 11/26/20 8:44 AM, Florent Revest wrote: > > +SEC("iter/task_file") > > +int fill_socket_owner(struct bpf_iter__task_file *ctx) > > +{ > > + struct task_struct *task = ctx->task; > > + struct file *file = ctx->file; > > + struct sock

Re: [PATCH bpf-next v3 5/6] bpf: Add an iterator selftest for bpf_sk_storage_get

2020-11-26 Thread Yonghong Song
On 11/26/20 8:44 AM, Florent Revest wrote: The eBPF program iterates over all files and tasks. For all socket files, it stores the tgid of the last task it encountered with a handle to that socket. This is a heuristic for finding the "owner" of a socket similar to what's done by lsof, ss, nets

[PATCH bpf-next v3 5/6] bpf: Add an iterator selftest for bpf_sk_storage_get

2020-11-26 Thread Florent Revest
The eBPF program iterates over all files and tasks. For all socket files, it stores the tgid of the last task it encountered with a handle to that socket. This is a heuristic for finding the "owner" of a socket similar to what's done by lsof, ss, netstat or fuser. Potentially, this information coul