diff options
| author | Andrii Nakryiko <[email protected]> | 2025-03-17 20:45:12 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <[email protected]> | 2025-03-17 20:45:13 +0000 |
| commit | b02f072a36560a89155a1ebcb2ca6bd881333a8b (patch) | |
| tree | 62436d27fd49365a4db2b9fa92065b6aabbca28c /tools/bpf/bpftool/prog.c | |
| parent | bpf, x86: Fix objtool warning for timed may_goto (diff) | |
| parent | selftests/bpf: Test freplace from user namespace (diff) | |
| download | kernel-b02f072a36560a89155a1ebcb2ca6bd881333a8b.tar.gz kernel-b02f072a36560a89155a1ebcb2ca6bd881333a8b.zip | |
Merge branch 'support-freplace-prog-from-user-namespace'
Mykyta Yatsenko says:
====================
Support freplace prog from user namespace
From: Mykyta Yatsenko <[email protected]>
Freplace programs can't be loaded from user namespace, as
bpf_program__set_attach_target() requires searching for target prog BTF,
which is locked under CAP_SYS_ADMIN.
This patch set enables this use case by:
1. Relaxing capable check in bpf's BPF_BTF_GET_FD_BY_ID, check for CAP_BPF
instead of CAP_SYS_ADMIN, support BPF token in attr argument.
2. Pass BPF token around libbpf from bpf_program__set_attach_target() to
bpf syscall where capable check is.
3. Validate positive/negative scenarios in selftests
This patch set is enabled by the recent libbpf change[1], that
introduced bpf_object__prepare() API. Calling bpf_object__prepare() for
freplace program before bpf_program__set_attach_target() initializes BPF
token, which is then passed to bpf syscall by libbpf.
[1] https://lore.kernel.org/all/[email protected]/
====================
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Andrii Nakryiko <[email protected]>
Diffstat (limited to 'tools/bpf/bpftool/prog.c')
0 files changed, 0 insertions, 0 deletions
