Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFix CMSG_LEN #54
Merged
Fix CMSG_LEN #54
+50
−42
Conversation
A series of tests with messages carrying various numbers of FDs. This should help finding possible errors in the various calculations regarding message size etc. The tests are using large transfers, as these invoke additional size calculations that need to be checked too.
There was a bracing error in the transcription of the original C macro, making it effectively equivalent to CMSG_SPACE(). (It would produce an even more weird result on systems where CMSG_ALIGN(cmsghdr) is not a no-op -- but that seems a rather hypothetical case, considering the definition of the structure, which naturally aligns to sizeof size_t both on systems with sizeof size_t == sizeof int and with sizeof size_t == 2 * sizeof int...) This bug resulted in undesired padding on systems where CMSG_ALIGN() is not a total no-op. (I.e. x86_64, but not i386.)
Do not pad the auxillary data message with /dev/null FDs anymore. I'm pretty sure this was only ever necessary because of the CMSG_LEN() bug. (It resulted in the unoccupied padding space in the auxillary data buffer to be actually declared as used... Now that this is no longer the case, there is no need anymore to fill it up with dummy values.) Tests with fixed and unfixed CMSG_LEN() do seem to confirm this.
|
@bors-servo: r+ |
|
|
bors-servo
added a commit
that referenced
this pull request
Mar 23, 2016
Fix CMSG_LEN This fixes a bug in the `CMSG_LEN` function; drops the ugly workaround that was necessitated by it; and adds a series of test cases to help identify possible problems in this (and related) areas.
|
|
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.
antrik commentedMar 22, 2016
This fixes a bug in the
CMSG_LENfunction; drops the ugly workaround that was necessitated by it; and adds a series of test cases to help identify possible problems in this (and related) areas.