# Re: \[PATCH net-next 1/3\] bpf: introduce current-\>pid, tgid, uid, gid, comm accessors

- From: Andy Lutomirski \<luto@amacapital.net\>
- Date: 2015-06-12 22:54:36 
- List: linux-api
- Page: https://ratatoskr.run/linux-api/2015/06/4515115
- Thread: https://ratatoskr.run/linux-api/2015/06/4515090/t.md

```text
On Fri, Jun 12, 2015 at 3:44 PM, Alexei Starovoitov [ref] wrote:
> On 6/12/15 3:08 PM, Andy Lutomirski wrote:
>>
>> On Fri, Jun 12, 2015 at 2:40 PM, Alexei Starovoitov [ref]
>> wrote:
>>>
>>> eBPF programs attached to kprobes need to filter based on
>>> current->pid, uid and other fields, so introduce helper functions:
>>>
>>> u64 bpf_get_current_pid_tgid(void)
>>> Return: current->tgid << 32 | current->pid
>>>
>>> u64 bpf_get_current_uid_gid(void)
>>> Return: current_gid << 32 | current_uid
>>
>>
>> How does this work wrt namespaces,
>
>
> from_kuid(current_user_ns(), uid)
>

Is current_user_ns() well defined in the context of an eBPF program?

--Andy
```
