-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[#8912] Safer, better UNIX socket ancillary data decoding #652
Merged
glyph
merged 32 commits into
twisted:trunk
from
exvito:8912-exvito-safer-unix-do-read-tk2
Feb 16, 2017
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
7d0b3b6
Safer, more complete decoding UNIX socket recvmsg ancillary data.
exvito 321d4f8
Refactored multi fileDescriptorReceived test - now exercising the loop.
exvito 784aa37
Test bad ancillary data from recvmsg.
exvito f0a1962
Wrap a long line to comply with twistedchecker rules.
exvito d62614e
Merge branch 'trunk' into 8912-exvito-safer-unix-do-read-tk2
exvito b39b048
Merge branch 'trunk' into 8912-exvito-safer-unix-do-read-tk2
exvito 9c3e589
Rename method to adhere to coding standard.
exvito f4d60c2
Better method doc string, now with @param entry.
exvito eede87c
Fix test skip for incoming UNIX socket ancillary data: now outside of…
exvito 37ac2bc
Really fix test skip for incoming UNIX socket ancillary data on Mac.
exvito fb53001
Removed unused SkipTest import.
exvito f79830a
Nice test skip message for incoming UNIX socket ancillary data on Mac.
exvito f43b6ce
Cleaner test skip logic for incoming UNIX socket ancillary data.
exvito b52a18a
Merge branch 'trunk' into 8912-exvito-safer-unix-do-read-tk2
exvito ba30b53
Merge branch 'trunk' into 8912-exvito-safer-unix-do-read-tk2
exvito 12e0314
Use t.t.u.TestCase.patch instead of monkey patching by hand.
exvito df71bda
Typo correction in UNIX ancillary data test comment.
exvito 047bd99
Improve bad UNIX ancillary data test - verify message is logged.
exvito 38f50ee
Merge remote-tracking branch 'exvito/8912-exvito-safer-unix-do-read-t…
exvito fbfb339
Factor out SOL_SOCKET/SCM_RIGHTS UNIX ancillary data handling.
exvito c4d2774
Rename factored out method to comply with twistedchecker.
exvito 4888d4c
Better unsupported UNIX ancillary data test.
exvito 1824a36
Ensure full coverage of test code.
exvito 718a313
Verify multiple UNIX FD receiving respects order.
exvito 993e344
Merge branch 'trunk' into 8912-exvito-safer-unix-do-read-tk2
exvito 0d8fc93
Merge branch 'trunk' into 8912-exvito-safer-unix-do-read-tk2
glyph 0e5b7c5
File instead of socket FDs now used in multi fileDescriptorReceived t…
exvito 1de0b1c
Remove unused imports.
exvito 0873b20
Merge branch 'trunk' into 8912-exvito-safer-unix-do-read-tk2
glyph e1578ef
Minor code style adjustments.
exvito 77f7cc7
Reword topfile: better for users while still technically detailed.
exvito f4dbdbb
Merge branch 'trunk' into 8912-exvito-safer-unix-do-read-tk2
glyph File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| UNIX socket endpoints now process all messages from recvmsg's ancillary data via twisted.internet.unix.Server.doRead/twisted.internet.unix.Client.doRead, while discarding and logging ones that don't contain file descriptors. |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(required)
Hmm. The existing assertion doesn't verify that the order of file descriptors received is the same as the order of file descriptors sent? So if the implementation mixed them up we wouldn't notice... Is that right?
If so, that seems moderately unfortunate. It's a pre-existing defect so it could be fixed in a follow-up ticket. Please either fix it here or file that follow-up ticket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct. This requires the non-trivial generic challenge of asserting two file descriptors actually "point" to the same underlying "kernel managed object".
The current test implementation only makes this more difficult, I guess, given that it is using the same UNIX socket FDs obtained via
socketpairfor two purposes:Verifying that two UNIX socket FDs actually "point" to the same underlying socket is something I couldn't figure out how to do. In particular given the fact that these sockets were obtained via
socketpair.Two ideas come to my mind:
os.fstatlater to verify which is which. Not sure ifsocketpairconnected sockets can be bound when obtained + how different platforms handle that.Maybe there is some better approach at this. Which are your thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pushed a commit with the first approach I commented above:
FakeProtocoltrack not only FDs but alsofstat's (st_dev,st_ino) tuples.st_dev,st_ino)tuples against the ones tracked byFakeProtocol.Feedback welcome.