All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf v2 0/2] Fix effective prog array indexing with BPF_F_PREORDER
@ 2026-06-19  6:35 Amery Hung
  2026-06-19  6:35 ` [PATCH bpf v2 1/2] bpf: Fix effective prog array index " Amery Hung
  2026-06-19  6:35 ` [PATCH bpf v2 2/2] selftests/bpf: Test cgroup link replace " Amery Hung
  0 siblings, 2 replies; 7+ messages in thread
From: Amery Hung @ 2026-06-19  6:35 UTC (permalink / raw)
  To: bpf
  Cc: alexei.starovoitov, andrii, daniel, eddyz87, memxor, martin.lau,
	ameryhung, kernel-team

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(-)

-- 
2.53.0-Meta


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

end of thread, other threads:[~2026-06-20 20:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-19  6:35 [PATCH bpf v2 0/2] Fix effective prog array indexing with BPF_F_PREORDER Amery Hung
2026-06-19  6:35 ` [PATCH bpf v2 1/2] bpf: Fix effective prog array index " Amery Hung
2026-06-19  6:46   ` sashiko-bot
2026-06-20 20:54     ` Yonghong Song
2026-06-20 20:45   ` Yonghong Song
2026-06-19  6:35 ` [PATCH bpf v2 2/2] selftests/bpf: Test cgroup link replace " Amery Hung
2026-06-20 20:46   ` Yonghong Song

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.