-
Notifications
You must be signed in to change notification settings - Fork 151
bpf: Fix truncated dmabuf iterator reads #10423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: bpf_base
Are you sure you want to change the base?
Conversation
|
Upstream branch: 30f0920 |
4f34c49 to
bc9f2f4
Compare
|
Upstream branch: 30f0920 |
a8e9f36 to
6931c6b
Compare
bc9f2f4 to
d81819b
Compare
|
Upstream branch: 8f7aa3d |
6931c6b to
7977aab
Compare
d81819b to
4a41073
Compare
|
Upstream branch: 835a507 |
7977aab to
7cf5b07
Compare
4a41073 to
892a959
Compare
|
Upstream branch: 861111b |
7cf5b07 to
55333dc
Compare
892a959 to
f33722a
Compare
|
Upstream branch: 861111b |
55333dc to
b37b182
Compare
f33722a to
6627cb2
Compare
If there is a large number (hundreds) of dmabufs allocated, the text output generated from dmabuf_iter_seq_show can exceed common user buffer sizes (e.g. PAGE_SIZE) necessitating multiple start/stop cycles to iterate through all dmabufs. However the dmabuf iterator currently returns NULL in dmabuf_iter_seq_start for all non-zero pos values, which results in the truncation of the output before all dmabufs are handled. After dma_buf_iter_begin / dma_buf_iter_next, the refcount of the buffer is elevated so that the BPF iterator program can run without holding any locks. When a stop occurs, instead of immediately dropping the reference on the buffer, stash a pointer to the buffer in seq->priv until either start is called or the iterator is released. This also enables the resumption of iteration without first walking through the list of dmabufs based on the pos value. Fixes: 76ea955 ("bpf: Add dmabuf iterator") Signed-off-by: T.J. Mercier <[email protected]>
If many dmabufs are present, reads of the dmabuf iterator can be truncated at PAGE_SIZE or user buffer size boundaries before the fix in "selftests/bpf: Add test for open coded dmabuf_iter". Add a test to confirm truncation does not occur. Signed-off-by: T.J. Mercier <[email protected]>
|
Upstream branch: 861111b |
b37b182 to
ae6d2a8
Compare
Pull request for series with
subject: bpf: Fix truncated dmabuf iterator reads
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1030279