bpf, sockmap: keep sk_msg copy bitmap in sync#12138
Open
kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
Open
bpf, sockmap: keep sk_msg copy bitmap in sync#12138kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
Conversation
Author
|
Upstream branch: 49b1831 |
bdffe6c to
0bc2057
Compare
Author
|
Upstream branch: 7dd6256 |
The sk_msg scatterlist ring stores the actual page descriptors in sg.data[] and stores the copy-required state for each slot in the parallel sg.copy bitmap. bpf_msg_pull_data() trusts this bitmap to know whether the current slot can be exposed for direct packet access or whether it has to be copied into a private page first. Several SK_MSG helpers move or split sg.data[] entries without moving the matching sg.copy bit. In particular, bpf_msg_push_data() can split a copy-marked entry and place the tail in a new slot with a stale clear copy bit. A later bpf_msg_pull_data() can then skip the private copy and expose a direct writable pointer to the shared page. Keep sg.copy synchronized whenever these helpers move, split, replace or remove scatterlist entries. Clear the bit for newly allocated private pages and preserve it for descriptors that still refer to the original shared backing page. 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") Reported-by: Junxi Qian <qjx1298677004@gmail.com> Reported-by: Qi Tang <tpluszz77@gmail.com> Signed-off-by: Junxi Qian <qjx1298677004@gmail.com> Cc: stable@vger.kernel.org
dc3e3a4 to
dcadfed
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: bpf, sockmap: keep sk_msg copy bitmap in sync
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1097961