This repository was archived by the owner on Jan 23, 2023. It is now read-only.
fix dereferencing uninitialized byte array in case recv() fails#30312
Merged
Conversation
Member
Author
|
@dotnet-bot test Outerloop Windows x64 Debug Build |
stephentoub
approved these changes
Jun 12, 2018
Member
stephentoub
left a comment
There was a problem hiding this comment.
LGTM. Thanks for tracking it down and fixing it.
Member
|
Failed tests are unrelated (e.g. https://github.com/dotnet/corefx/issues/30320, https://github.com/dotnet/corefx/issues/30321) |
gbalykov
pushed a commit
to gbalykov/corefx
that referenced
this pull request
Jun 21, 2018
wfurt
added a commit
to wfurt/corefx
that referenced
this pull request
Jun 26, 2018
wfurt
added a commit
that referenced
this pull request
Jul 3, 2018
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
fixes #29376 [arm32/Ubuntu] corefx test failures: System.Net.NetworkInformation.Functional.Tests, System.Net.Sockets.Tests
related to #27411 Re-enable initlocals clearing in System.Net.Sockets on Unix
We disabled initialization of local variables for sockets. We pass buffer allocated via stackalloc() to get ancillary data. When recv() call fails (like with EAGAIN) the buffer is uninitialized and it is not safe to parse it and use data or pointers from it. This does not seems ARM specific bug. X86 may be just more lucky getting stack full of zeros. My initial POC was to initialize control buffer (24b) to zeros.so
That fixes the crash as well (by fining first message has 0 length) but I think this fix is better.
It would be nice IMHO if we do not need to allocate ipPacketInformation but that is beyond this fix.
I also briefly scan for other use of stackalloc() in sockets and the other place looks reasonable.
I re-run all (outerloop) test on ARM system and I see no crash. Four tests timed out - but the ARM system is MUCH slower so this may not be sign of real problem.