-
Notifications
You must be signed in to change notification settings - Fork 28
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
Avoid leaking file descriptors #83
base: master
Are you sure you want to change the base?
Conversation
This mostly avoids spurious SELinux denials, but it is good practice anyway. Should fix the file descriptor leakage in #5214.
OpenQA test summaryComplete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.1&build=2022021806-4.1&flavor=pull-requests New failures, excluding unstableCompared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.1&build=2022021706-4.1&flavor=update
Failed tests2 failures
Fixed failuresCompared to: https://openqa.qubes-os.org/tests/35157#dependencies 21 fixed
Unstable tests
|
errno = 0; | ||
fd_num = strtol(entry->d_name, &endptr, 10); | ||
if (errno || !endptr || *endptr || fd_num < 0 || fd_num > INT_MAX) | ||
errx(1, "bad number in /proc/self/fd"); |
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.
This always trips, I'm pretty sure it's about .
or ..
.
Anyway, setting all FDs to O_CLOEXEC
sounds fragile (there may be cases when inheriting open FD would be desirable, even if currently it isn't used), and also could hide other issues. I'd prefer to do it properly:
- inspect what FDs are currently passed on to children, and for each consciously decide whether
O_CLOEXEC
is desirable (or maybe it shouldn't be left open at all?) - (optionally) add a test that checks for FD leaks - we do have proper unit tests in this repo, so it shouldn't be too hard. see
qrexec/tests/socket/agent.py
for example
This mostly avoids spurious SELinux denials, but it is good practice anyway.
Should fix the file descriptor leakage in QubesOS/qubes-issues#5214.