aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
diff options
context:
space:
mode:
authorJohn Fastabend <[email protected]>2020-05-24 16:50:55 +0000
committerAlexei Starovoitov <[email protected]>2020-06-01 21:38:20 +0000
commitf470378c7562a2818b45ed11c98973f2b89eedd3 (patch)
tree644a058b0dd4945cc4fe53c4e07c299ba68d16a7 /tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
parentbpf, sk_msg: Add some generic helpers that may be useful from sk_msg (diff)
downloadkernel-f470378c7562a2818b45ed11c98973f2b89eedd3.tar.gz
kernel-f470378c7562a2818b45ed11c98973f2b89eedd3.zip
bpf: Extend bpf_base_func_proto helpers with probe_* and *current_task*
Often it is useful when applying policy to know something about the task. If the administrator has CAP_SYS_ADMIN rights then they can use kprobe + networking hook and link the two programs together to accomplish this. However, this is a bit clunky and also means we have to call both the network program and kprobe program when we could just use a single program and avoid passing metadata through sk_msg/skb->cb, socket, maps, etc. To accomplish this add probe_* helpers to bpf_base_func_proto programs guarded by a perfmon_capable() check. New supported helpers are the following, BPF_FUNC_get_current_task BPF_FUNC_probe_read_user BPF_FUNC_probe_read_kernel BPF_FUNC_probe_read_user_str BPF_FUNC_probe_read_kernel_str Signed-off-by: John Fastabend <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Yonghong Song <[email protected]> Link: https://lore.kernel.org/bpf/159033905529.12355.4368381069655254932.stgit@john-Precision-5820-Tower Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/sockmap_basic.c')
0 files changed, 0 insertions, 0 deletions