libbpf: Fix perm errors for LDIMM_64_FULL_RANGE_OFF
Status from this message: applied to bpf tree, thanks!
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest2 patches 1 replyApplied
- v22 patches 4 repliesSuperseded
- v12 patches 0 repliesSuperseded
Patches in v3 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | libbpf: Do not use PROG_TYPE_TRACEPOINT program for feature gatingtools/ | +8 | 0 replies | |
| 2/2 | libbpf: Delay feature gate check until object prepare timetools/ | +19 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH bpf v3 0/2] libbpf: Fix perm errors for LDIMM_64_FULL_RANGE_OFF
Commit 728ff167910e ("libbpf: Add gating for arena globals relocation feature") adds a feature flag for testing whether the running kernel supports LDIMM64 instructions with large direct offsets. Fix two edge cases that can cause unexpected -EPERM errors in two ways:
1) The probe program used for the feature has type TRACEPOINT, but it's possible the caller does not have permission to load it, even if it is able to do so for generic BPF programs. Use the SOCKET_FILTER type instead that requires fewer permissions. This does not affect the check itself, which will always fail verification anyway.
2) The probe is triggered during bpf_object__collect_relos(), itself called in bpf_object_open(), to compute the arena relocation offsets of arena variables. However, the caller may not have permissions to load BPF programs. This is the case in some systems with the bpftool calls made by the BPF selftests during compilation, e.g., for skeleton generation. Move all uses of the feature check to bpf_object_prepare() time instead.
v2 -> v3: https://lore.kernel.org/bpf/[email protected]/
- Only zero out the first byte of the log buffer (Andrii)
- Minimize invocations of the feature gate (Andrii)
v1 -> v2: https://lore.kernel.org/bpf/[email protected]/
- Adjust the hash of the original commit post-tree rebase
- Ensure close() is not called on invalid prog_fd in feature probe (Coverity)
Emil Tsalapatis (2):
libbpf: Do not use PROG_TYPE_TRACEPOINT program for feature gating
libbpf: Delay feature gate check until object prepare time
tools/lib/bpf/features.c | 10 ++++++++-- tools/lib/bpf/libbpf.c | 26 +++++++++++++++++++------- 2 files changed, 27 insertions(+), 9 deletions(-)
Signature · 1 line
2.49.0