On 3/22/17 5:06 AM, Lorenzo Colitti wrote:
On Wed, Mar 22, 2017 at 8:09 PM, Willem de Bruijn
wrote:
+ if (!sk || !sk_fullsock(sk))
+ return overflowuid;
+ kuid = sock_net_uid(sock_net(sk), sk);
+ return from_kuid_munged(&init_user_ns, kuid);
Ideally, this would
On Wed, Mar 22, 2017 at 8:09 PM, Willem de Bruijn
wrote:
>> + if (!sk || !sk_fullsock(sk))
>> + return overflowuid;
>> + kuid = sock_net_uid(sock_net(sk), sk);
>> + return from_kuid_munged(&init_user_ns, kuid);
>
> Ideally, this would be the user namespace relative
> +BPF_CALL_1(bpf_get_socket_uid, struct sk_buff *, skb)
> +{
> + struct sock *sk = sk_to_full_sk(skb->sk);
> + kuid_t kuid;
> +
> + if (!sk || !sk_fullsock(sk))
> + return overflowuid;
> + kuid = sock_net_uid(sock_net(sk), sk);
> + return from_kuid_munge
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