[REVERTME] net/socket: Add msg_copy_to_user and msg_copy_from_user fo…#451
Closed
[REVERTME] net/socket: Add msg_copy_to_user and msg_copy_from_user fo…#451
Conversation
04bad7b to
62d952d
Compare
This adds copying to/from kerenel memory when doing sendmsg/recvmsg to avoid corrupting messages or other process' address environment, when the actual device drivers do copy while the calling process is blocked. This patch allocates one IOB for storing the metadata and the payload. If the payload doesn't fit in the IOB, the payload is allocated from the kernel heap. In other words, to optimize number of heap allocations, one can increase the IOB size so that all the packets fit in one IOB. This needs to be reverted when there is similar fix in upstream; the work is in progress in apache#18712 Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
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.
Hai earlier reported "https://jira.tii.ae/browse/SSRCDP-11725", he found corrupted can frames coming from NuttX network stack.
The issue appeared at some point, when updating NuttX baseline to a newer one, but it was never quite understood.
The issue seems to be profound and serious; in kernel builds, the network stack sometimes uses user-side buffer pointers in copying data, in recvmsg /sendmsg - not just for can, but for all blocking socket transfers.
This has been discovered by @arjav1528 in upstream apache NuttX, and started a fix proposal
https://redirect.github.com/apache/nuttx/pull/18712
The upstream issue tracking is in
https://redirect.github.com/apache/nuttx/issues/17321.
Until the issue gets resolved upstream, I believe we need to introduce a temporary fix in tiiuae branch. This PR introduces a network packet copy_from_user / copy_to_user fix to solve the issue. When the issue has been resolved upstream, this patch can be reverted.