-
Notifications
You must be signed in to change notification settings - Fork 5
bpf: Fix truncated dmabuf iterator reads #6459
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 |
ad17a83 to
db65bfd
Compare
|
Upstream branch: 30f0920 |
8d5967a to
9363aae
Compare
db65bfd to
b55f0a6
Compare
|
Upstream branch: 8f7aa3d |
9363aae to
813506c
Compare
b55f0a6 to
0d4aada
Compare
|
Upstream branch: 835a507 |
813506c to
7baa308
Compare
0d4aada to
619639b
Compare
|
Upstream branch: 861111b |
7baa308 to
74195fe
Compare
619639b to
f0cd774
Compare
|
Upstream branch: 861111b |
74195fe to
a21a50a
Compare
f0cd774 to
cb6e082
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 |
a21a50a to
25eb8fe
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