History

bpf: Enable more helpers for BPF_PROG_TYPE_CGROUP_{DEVICE,SYSCTL,SOCKOPT}

Currently the following prog types don't fall back to bpf_base_func_proto() (instead they have cgroup_base_func_proto which has a limited set of helpers from bpf_base_func_proto): * BPF_PROG_TYPE_CGROUP_DEVICE * BPF_PROG_TYPE_CGROUP_SYSCTL * BPF_PROG_TYPE_CGROUP_SOCKOPT I don't see any specific reason why we shouldn't use bpf_base_func_proto(), every other type of program (except bpf-lirc and, understandably, tracing) use it, so let's fall back to bpf_base_func_proto for those prog types as well. This basically boils down to adding access to the following helpers: * BPF_FUNC_get_prandom_u32 * BPF_FUNC_get_smp_processor_id * BPF_FUNC_get_numa_node_id * BPF_FUNC_tail_call * BPF_FUNC_ktime_get_ns * BPF_FUNC_spin_lock (CAP_SYS_ADMIN) * BPF_FUNC_spin_unlock (CAP_SYS_ADMIN) * BPF_FUNC_jiffies64 (CAP_SYS_ADMIN) I've also added bpf_perf_event_output() because it's really handy for logging and debugging.

Stanislav Fomichev committed 6 years ago

Commit 0456ea11 parent 93e51684 files · +29 −18Browse files

Showing the changes to include/linux (1 of 4 files). Show all

Unified · Split

include/linux/bpf.h+1−0
@@ -1523,6 +1523,7 @@ extern const struct bpf_func_proto bpf_strtoul_proto; · 1522 unmodified lines
15231523 extern const struct bpf_func_proto bpf_tcp_sock_proto;
15241524 extern const struct bpf_func_proto bpf_jiffies64_proto;
15251525 extern const struct bpf_func_proto bpf_get_ns_current_pid_tgid_proto;
1526+extern const struct bpf_func_proto bpf_event_output_data_proto;
15261527
15271528 const struct bpf_func_proto *bpf_tracing_func_proto(
15281529 enum bpf_func_id func_id, const struct bpf_prog *prog);