Skip to content

[3.6] bpo-32777: Fix _Py_set_inheritable async-safety in subprocess (GH-5560) #5563

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

Merged
merged 1 commit into from
Feb 6, 2018

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Feb 6, 2018

Fix a rare but potential pre-exec child process deadlock in subprocess on POSIX systems when marking file descriptors inheritable on exec in the child process. This bug appears to have been introduced in 3.4 with the inheritable file descriptors support.

This also changes Python/fileutils.c set_inheritable to use the "slow" two fcntl syscall path instead of the "fast" single ioctl syscall path when asked to be async signal safe (by way of being asked not to raise exceptions). ioctl is not a POSIX async-signal-safe approved function.

ref: http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html
(cherry picked from commit c1e46e9)

Co-authored-by: Alexey Izbyshev izbyshev@users.noreply.github.com

https://bugs.python.org/issue32777

…GH-5560)

Fix a rare but potential pre-exec child process deadlock in subprocess on POSIX systems when marking file descriptors inheritable on exec in the child process.  This bug appears to have been introduced in 3.4 with the inheritable file descriptors support.

This also changes Python/fileutils.c `set_inheritable` to use the "slow" two `fcntl` syscall path instead of the "fast" single `ioctl` syscall path when asked to be async signal safe (by way of being asked not to raise exceptions).  `ioctl` is not a POSIX async-signal-safe approved function.

ref: http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html
(cherry picked from commit c1e46e9)

Co-authored-by: Alexey Izbyshev <izbyshev@users.noreply.github.com>
@miss-islington
Copy link
Contributor Author

@izbyshev and @gpshead: Backport status check is done, and it's a success ✅ .

@gpshead gpshead merged commit b90c685 into python:3.6 Feb 6, 2018
@miss-islington
Copy link
Contributor Author

Thanks, @gpshead!

@miss-islington miss-islington deleted the backport-c1e46e9-3.6 branch February 6, 2018 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants