]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bpftool: Use appropriate permissions for map access
authorSlava Imameev <slava.imameev@crowdstrike.com>
Fri, 20 Jun 2025 15:18:11 +0000 (01:18 +1000)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 20 Jun 2025 18:13:03 +0000 (11:13 -0700)
commitd32179e8c2583f1613f7bc9710612091c3c038d8
treed14c74e2fe0292ada1a1f872b7177779cf9ac2c5
parente30329b8a6476eed87460e73a29ecd718ec981e1
bpftool: Use appropriate permissions for map access

Modify several functions in tools/bpf/bpftool/common.c to allow
specification of requested access for file descriptors, such as
read-only access.

Update bpftool to request only read access for maps when write
access is not required. This fixes errors when reading from maps
that are protected from modification via security_bpf_map.

Signed-off-by: Slava Imameev <slava.imameev@crowdstrike.com>
Reviewed-by: Quentin Monnet <qmo@kernel.org>
Link: https://lore.kernel.org/r/20250620151812.13952-1-slava.imameev@crowdstrike.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/bpf/bpftool/btf.c
tools/bpf/bpftool/common.c
tools/bpf/bpftool/iter.c
tools/bpf/bpftool/link.c
tools/bpf/bpftool/main.h
tools/bpf/bpftool/map.c
tools/bpf/bpftool/map_perf_ring.c
tools/bpf/bpftool/prog.c