mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 05:31:15 +00:00
bpf: Add a bpf_sock_from_file helper
While eBPF programs can check whether a file is a socket by file->f_op == &socket_file_ops, they cannot convert the void private_data pointer to a struct socket BTF pointer. In order to do this a new helper wrapping sock_from_file is added. This is useful to tracing programs but also other program types inheriting this set of helpers such as iterators or LSM programs. Signed-off-by: Florent Revest <revest@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: KP Singh <kpsingh@google.com> Acked-by: Martin KaFai Lau <kafai@fb.com> Link: https://lore.kernel.org/bpf/20201204113609.1850150-2-revest@google.com
This commit is contained in:
parent
dba4a9256b
commit
4f19cab761
4 changed files with 42 additions and 0 deletions
|
@ -437,6 +437,8 @@ class PrinterHelpers(Printer):
|
|||
'struct path',
|
||||
'struct btf_ptr',
|
||||
'struct inode',
|
||||
'struct socket',
|
||||
'struct file',
|
||||
]
|
||||
known_types = {
|
||||
'...',
|
||||
|
@ -482,6 +484,8 @@ class PrinterHelpers(Printer):
|
|||
'struct path',
|
||||
'struct btf_ptr',
|
||||
'struct inode',
|
||||
'struct socket',
|
||||
'struct file',
|
||||
}
|
||||
mapped_types = {
|
||||
'u8': '__u8',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue