bpf: Expose bpf_get_socket_cookie to tracing programs
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 <revest@chromium.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: KP Singh <kpsingh@kernel.org> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20210210111406.785541-2-revest@chromium.org
This commit is contained in:
committed by
Alexei Starovoitov
parent
07881ccbf4
commit
c5dbb89fc2
@@ -1673,6 +1673,14 @@ union bpf_attr {
|
||||
* Return
|
||||
* A 8-byte long unique number.
|
||||
*
|
||||
* u64 bpf_get_socket_cookie(struct sock *sk)
|
||||
* Description
|
||||
* Equivalent to **bpf_get_socket_cookie**\ () helper that accepts
|
||||
* *sk*, but gets socket from a BTF **struct sock**. This helper
|
||||
* also works for sleepable programs.
|
||||
* Return
|
||||
* A 8-byte long unique number or 0 if *sk* is NULL.
|
||||
*
|
||||
* u32 bpf_get_socket_uid(struct sk_buff *skb)
|
||||
* Return
|
||||
* The owner UID of the socket associated to *skb*. If the socket
|
||||
|
||||
Reference in New Issue
Block a user