Re: [PATCH net-next v6 2/3] Add a eBPF helper function to retrieve socket uid

2017-03-21 Thread Lorenzo Colitti
On Tue, Mar 21, 2017 at 1:08 PM, Chenbo Feng wrote: > + if (!sk || !sk_fullsock(sk)) > + return overflowuid; > + kuid = sock_net_uid(sock_net(sk), sk); > + return from_kuid_munged(current_user_ns(), kuid); Is current_user_ns() correct in all the contexts you'll wan

Re: [PATCH net-next v6 2/3] Add a eBPF helper function to retrieve socket uid

2017-03-20 Thread Alexei Starovoitov
On Mon, Mar 20, 2017 at 09:08:56PM -0700, Chenbo Feng wrote: > From: Chenbo Feng > > Returns the owner uid of the socket inside a sk_buff. This is useful to > perform per-UID accounting of network traffic or per-UID packet > filtering. The socket need to be a fullsock otherwise overflowuid is > r

[PATCH net-next v6 2/3] Add a eBPF helper function to retrieve socket uid

2017-03-20 Thread Chenbo Feng
From: Chenbo Feng Returns the owner uid of the socket inside a sk_buff. This is useful to perform per-UID accounting of network traffic or per-UID packet filtering. The socket need to be a fullsock otherwise overflowuid is returned. Signed-off-by: Chenbo Feng --- include/uapi/linux/bpf.h