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
os.set_inheritable(): fall back to fcntl() if ioctl() fails with EACCES #71244
Comments
When SELinux forbids ioctl() it fails with EACCES and whole os.set_inheritable raises exception. As in https://bugs.python.org/issue22258 code was added to fall back to fcntl when ioctl() fails with ENOTTY I'm adding EACCES value to same condition to fall back to fcntl(). |
Hum, I'm surprised that SELinux blocks such safe function. Maybe the SELinux policy should be completed to allow it? Detect when ioctl() fails with EACCESS and fallback to fnctl() sounds like a good option. But do you expect ioctl() to always fail with EACCESS? Or only fail sometimes, or only on some file descriptors? Your patch remembers that ioctl() fails once and never retries. About your patch: please add a comment explaining why you fallback with a reference to this issue ("Issue bpo-27057"). |
|
New changeset 13c5135d8467 by Victor Stinner in branch '3.5': New changeset 783c1b8cdddb by Victor Stinner in branch 'default': |
Oh. Right :-) My intent was to suggest to report the SELinux issue upstream ;-)
The purpose of using ioctl() is to *reduce* the number of syscalls. If an application mostly use sockets, it will do 3 syscalls per socket (ioctl, fcntl get, fcntl set) instead of just 2 (fcntl get, fcntl set) :-/ So I like your patch ;-) I applied your fix to Python 3.5 and 3.6. Thanks for your contribution. You should now sign the PSF Contributor Agreement: (Well, in fact it would be better to do that *before* merging your change, but well, your change is short enough ;-)) |
|
Thanks! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: