-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
net/bpf: Fix writing of buffer bigger than PAGESIZE (Bug 205164) #131
Conversation
When allocating the mbuf we used m_get2 which fails if len is superior to MJUMPAGESIZE, if its the case, use m_getjcl instead. This fixes bug 205164.
This may be useful context: The main concern is that allocating large contiguous memory areas (as is required for BPF) is problematic, especially under memory pressure. Changing the BPF code to cope with non-contiguous memory would be difficult, so I'm not sure what the best solution would be here. |
Well as i am fairly new to the internals of bpf, im someone can help me get up to speed, maybe i could patch this in a 'better' way allowing jumbo writes even under memory pressure. |
After the allocation of the mbuf the data that's supposed to be sent is copied from user space (that's the uiomove() call). That can be adapted to deal with an mbuf chain. |
When using M_NOWAIT to allocate a buffer, shouldn't it fail under memory pressure ? thus avoiding any 'real' issue with big clusters under memory pressure. |
That helps, but holding contiguous memory (larger than a single page) is problematic too. Ryan might be able to give you more information: https://lists.freebsd.org/pipermail/freebsd-net/2017-November/049258.html |
Hash f13da24 lands this. I confirmed with kp@ that this was a good chance and that the negative effects noted by Ryan are less bad than this not working. |
When allocating the mbuf we used m_get2 which fails if len is superior to MJUMPAGESIZE, if its the case, use m_getjcl instead. Reviewed by: kp@ PR: 205164 Pull Request: #131
When allocating the mbuf we used m_get2 which fails if len is superior to MJUMPAGESIZE, if its the case, use m_getjcl instead. Reviewed by: kp@ PR: 205164 Pull Request: freebsd/freebsd-src#131
When allocating the mbuf we used m_get2 which fails if len is superior to MJUMPAGESIZE, if its the case, use m_getjcl instead. Reviewed by: kp@ PR: 205164 Pull Request: freebsd/freebsd-src#131 (cherry picked from commit f13da24)
When allocating the mbuf we used m_get2 which fails
if len is superior to MJUMPAGESIZE, if its the case,
use m_getjcl instead.
This fixes bug 205164.