Fix effective prog array indexing with BPF_F_PREORDER
Status from this message: This series was applied to bpf/bpf.git (master)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest2 patches 3 repliesApplied 2/2
- v12 patches 2 repliesSuperseded
Changes in v2 from the cover letter
- Also fix purge_effective_progs(), in addition to replace_effective_prog() (Sashiko).
- selftest: Set err on bpf_link_create() failure so the failure is reported to the caller (Sashiko).
Patches in v2 All 2 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | bpf: Fix effective prog array index with BPF_F_PREORDERkernel/ | +62 | 2 replies | Applied |
| 2/2 | selftests/bpf: Test cgroup link replace with BPF_F_PREORDERtools/ | +77 | 1 reply | Applied |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | Yonghong Song |
|---|---|
| 1/2 | A-b |
| 2/2 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH bpf v2 0/2] Fix effective prog array indexing with BPF_F_PREORDER
Hi,
This patchset fixes a cgroup effective-array indexing bug where replace_effective_prog() and purge_effective_progs() used a linear hlist position that doesn't match the array layout when BPF_F_PREORDER programs are present, corrupting the array on link update and risking a use-after-free in the detach fallback. It computes the slot via a shared effective_prog_pos() helper and adds a cgroup_preorder selftest.
Changelog
v1 -> v2:
- Also fix purge_effective_progs(), in addition to replace_effective_prog() (Sashiko).
- selftest: Set err on bpf_link_create() failure so the failure is reported to the caller (Sashiko).
---
Amery Hung (2):
bpf: Fix effective prog array index with BPF_F_PREORDER selftests/bpf: Test cgroup link replace with BPF_F_PREORDER
kernel/bpf/cgroup.c | 108 ++++++++++-------- .../bpf/prog_tests/cgroup_preorder.c | 77 +++++++++++++ 2 files changed, 139 insertions(+), 46 deletions(-)
Signature · 1 line
2.53.0-Meta