utils: create the extcap FIFO with owner-only permissions - #5127
Open
KernelClint wants to merge 1 commit into
Open
utils: create the extcap FIFO with owner-only permissions#5127KernelClint wants to merge 1 commit into
KernelClint wants to merge 1 commit into
Conversation
AI-Assisted: yes (GPT-5.6-Cyber)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5127 +/- ##
=======================================
Coverage 80.63% 80.64%
=======================================
Files 390 390
Lines 96936 96936
=======================================
+ Hits 78168 78170 +2
+ Misses 18768 18766 -2
🚀 New features to boost your workflow:
|
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.
Scapy reads from an external capture helper through a named pipe:
get_temp_file()makes atemporary file, the pipe replaces it, and the helper writes capture bytes into it while Scapy reads
the other end.
The temporary file is created mode
0600, and thenscapy/utils.py:233-248unlinks it and calls
os.mkfifo()with no mode:os.mkfifo()defaults to0666, filtered only by the process umask. With the common default of022the pipe ends up world-readable, in a directory that is usually shared. Another account onthe machine can open the read side; pipe readers split a byte stream rather than each receiving a
copy, so that also leaves Scapy with a partial capture.
The change passes the mode the replaced file already had:
Scapy and the helper it starts both run as the owner, so nothing that worked before stops working.
The added regression asserts the FIFO's mode is
0600regardless of the umask in force. Removingthe mode argument makes it fail.
Performance was measured on one computer, before and after the fix: a capture round trip took
126.8 µs before and 123.3 µs after. Repeat runs of the same test moved by about 2%, so that
difference is smaller than the test can distinguish.