public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH bpf-next 0/2] bpf: Add a new kfunc bpf_current_capable
@ 2023-08-14 14:33 Yafang Shao
  2023-08-14 14:33 ` [RFC PATCH bpf-next 1/2] bpf: Add bpf_current_capable kfunc Yafang Shao
  2023-08-14 14:33 ` [RFC PATCH bpf-next 2/2] selftests/bpf: Add selftest for bpf_current_capable Yafang Shao
  0 siblings, 2 replies; 30+ messages in thread
From: Yafang Shao @ 2023-08-14 14:33 UTC (permalink / raw)
  To: ast, daniel, john.fastabend, andrii, martin.lau, song,
	yonghong.song, kpsingh, sdf, haoluo, jolsa
  Cc: bpf, Yafang Shao

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


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2023-09-28 11:13 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-14 14:33 [RFC PATCH bpf-next 0/2] bpf: Add a new kfunc bpf_current_capable Yafang Shao
2023-08-14 14:33 ` [RFC PATCH bpf-next 1/2] bpf: Add bpf_current_capable kfunc Yafang Shao
2023-08-15  0:28   ` Yonghong Song
2023-08-15  2:45     ` Yafang Shao
2023-08-15  3:40       ` Yonghong Song
2023-08-15  5:49         ` Yafang Shao
2023-08-15 15:19           ` Yonghong Song
2023-08-17  1:53       ` Alexei Starovoitov
2023-08-17  2:30         ` Yafang Shao
2023-08-17  3:30           ` Alexei Starovoitov
2023-08-17  7:09             ` Yafang Shao
2023-08-17 15:30               ` Daniel Borkmann
2023-08-17 17:45                 ` Alexei Starovoitov
2023-09-13 12:25                   ` [PATCH 1/3] Revert "selftests/bpf: Add selftest for allow_ptr_leaks" Luis Gerhorst
2023-09-14 12:50                     ` patchwork-bot+netdevbpf
2023-09-13 12:28                   ` [PATCH 2/3] Revert "bpf: Fix issue in verifying allow_ptr_leaks" Luis Gerhorst
2023-09-14 16:20                     ` Alexei Starovoitov
2023-09-14 17:24                       ` Daniel Borkmann
2023-09-14 19:47                         ` Alexei Starovoitov
2023-09-18 11:25                           ` Luis Gerhorst
2023-09-19  8:57                             ` Alexei Starovoitov
2023-09-28 11:09                               ` Luis Gerhorst
2023-09-15  2:26                     ` Yafang Shao
2023-09-18 11:52                       ` Luis Gerhorst
2023-09-19  3:43                         ` Yafang Shao
2023-09-19  6:43                           ` Daniel Borkmann
2023-09-13 12:31                   ` [PATCH 3/3] selftests/bpf: Add selftest for packet-pointer Spectre v1 gadget Luis Gerhorst
2023-08-21  5:56                 ` [RFC PATCH bpf-next 1/2] bpf: Add bpf_current_capable kfunc Yafang Shao
2023-08-17 17:48               ` Alexei Starovoitov
2023-08-14 14:33 ` [RFC PATCH bpf-next 2/2] selftests/bpf: Add selftest for bpf_current_capable Yafang Shao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox