bpf: Enforce cgroup storage map consistency for freplace attach - #13296
bpf: Enforce cgroup storage map consistency for freplace attach#13296kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
Conversation
|
Upstream branch: a13307e |
AI reviewed your patch. Please fix the bug or email reply why it's not a bug. In-Reply-To-Subject: |
|
Forwarding comment 5293970760 via email |
b73246f to
98d32d5
Compare
|
Upstream branch: a13307e |
8c14c64 to
0d0c43c
Compare
98d32d5 to
51ea595
Compare
|
Upstream branch: a13307e |
0d0c43c to
e9f6493
Compare
51ea595 to
3083173
Compare
|
Upstream branch: a13307e |
e9f6493 to
dcd3701
Compare
3083173 to
6d6454e
Compare
When a BPF_PROG_TYPE_EXT program replaces a cgroup program, it executes with the target's runtime context, including the per-program cgroup storage descriptor attached to the cgroup prog item. The verifier, however, bounds the extension's bpf_get_local_storage() accesses by the extension's own storage map. The prog-array path already enforces that programs sharing a runtime storage context reference identical storage maps (via the owner cookie matching added in commit abad3d0 ("bpf: Fix oob access in cgroup local storage")), but the freplace path performs no such consistency check in bpf_freplace_check_tgt_prog(). An extension whose storage map differs from the target's therefore operates on a buffer whose layout does not match its verified bounds. Reject the freplace attach with -EINVAL when the extension and the target program reference mismatched cgroup storage maps. Fixes: 7d9c342 ("bpf: Make cgroup storages shared between programs on the same cgroup") Reported-by: TencentOS Corvus AI <corvus@tencent.com> Cc: stable@vger.kernel.org Assisted-by: CodeBuddy:Kimi-K3 Signed-off-by: Aohan Mei <henrymei@tencent.com>
|
Upstream branch: a13307e |
dcd3701 to
6a6ed34
Compare
Pull request for series with
subject: bpf: Enforce cgroup storage map consistency for freplace attach
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1146069