Add a new kfunc bpf_current_capable to check whether the current task has a specific capability. In our use case, we will use it in a lsm bpf program to verify if the user operation is permitted based on our security policy. Yafang Shao (2): bpf: Add bpf_current_capable kfunc selftests/bpf: Add selftest for bpf_current_capable kernel/bpf/helpers.c | 6 ++ .../selftests/bpf/prog_tests/bpf_current_cap.c | 80 ++++++++++++++++++++++ .../selftests/bpf/progs/test_bpf_current_cap.c | 37 ++++++++++ 3 files changed, 123 insertions(+) create mode 100644 tools/testing/selftests/bpf/prog_tests/bpf_current_cap.c create mode 100644 tools/testing/selftests/bpf/progs/test_bpf_current_cap.c -- 1.8.3.1