bpf, sockmap: keep sk_msg copy state in sync#12137
bpf, sockmap: keep sk_msg copy state in sync#12137kernel-patches-daemon-bpf[bot] wants to merge 2 commits into
Conversation
|
Upstream branch: 523d2f4 |
AI reviewed your patch. Please fix the bug or email reply why it's not a bug. In-Reply-To-Subject: |
|
Forwarding comment 4497664011 via email |
|
Upstream branch: 523d2f4 |
0a58a0c to
8fdf7da
Compare
ceeb3aa to
ec31e3e
Compare
|
Upstream branch: 3db0419 |
8fdf7da to
970310f
Compare
ec31e3e to
b3beebb
Compare
|
Upstream branch: b1fcdf9 |
970310f to
f0c74f5
Compare
b3beebb to
01a7a7f
Compare
|
Upstream branch: eb19eea |
f0c74f5 to
607d585
Compare
01a7a7f to
f1eeafa
Compare
|
Upstream branch: 8496d90 |
607d585 to
7cbd047
Compare
f1eeafa to
d34771f
Compare
|
Upstream branch: e42e53a |
7cbd047 to
ae8a871
Compare
d34771f to
fe195c9
Compare
|
Upstream branch: be4c6c7 |
cf7c9e2 to
2c8f6e2
Compare
4131ade to
7a7c63d
Compare
|
Upstream branch: 04de7bc |
2c8f6e2 to
f4fb02d
Compare
7a7c63d to
245da81
Compare
|
Upstream branch: c169a2a |
SK_MSG uses msg->sg.copy as per-scatterlist-entry provenance. Entries with this bit set are copied before data/data_end are exposed to SK_MSG BPF programs for direct packet access. bpf_msg_pull_data(), bpf_msg_push_data(), and bpf_msg_pop_data() rewrite the sk_msg scatterlist ring by collapsing, splitting, and shifting entries. These operations move msg->sg.data[] entries, but the parallel copy bitmap can be left behind on the old slot. A copied entry can then return to msg->sg.start with its copy bit clear and be exposed as directly writable packet data. This corruption path requires an attached SK_MSG BPF program that calls the mutating helpers; ordinary sockmap/TLS traffic that never runs push/pop/pull helper sequences is not affected. Keep msg->sg.copy synchronized with scatterlist entry moves, preserve the copy bit when an entry is split, clear it when a helper replaces an entry with a private page, and clear slots vacated by pull-data compaction. Fixes: 015632b ("bpf: sk_msg program helper bpf_sk_msg_pull_data") Fixes: 6fff607 ("bpf: sk_msg program helper bpf_msg_push_data") Fixes: 7246d8e ("bpf: helper to pop data from messages") Cc: stable@vger.kernel.org Co-developed-by: Han Guidong <2045gemini@gmail.com> Signed-off-by: Han Guidong <2045gemini@gmail.com> Signed-off-by: Zhang Cen <rollkingzzc@gmail.com> Reviewed-by: John Fastabend <john.fastabend@gmail.com>
f4fb02d to
b0c1398
Compare
cf55c66 to
c7e2962
Compare
Pull request for series with
subject: bpf, sockmap: keep sk_msg copy state in sync
version: 3
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1097929