Skip to content

bpo-47151: Fallback to fork when vfork fails in subprocess. #32186

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 5 commits into from
Mar 31, 2022

Conversation

gpshead
Copy link
Member

@gpshead gpshead commented Mar 30, 2022

vfork() can return -1 and set errno. We now fall back to fork() in that situation as one possible error is EINVAL indicating that the kernel doesn't permit vfork from the current process. See the bug.

https://bugs.python.org/issue47151

@gpshead gpshead added type-bug An unexpected behavior, bug, or error needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes labels Mar 30, 2022
@gpshead gpshead marked this pull request as ready for review March 30, 2022 01:30
@gpshead gpshead requested a review from vstinner March 30, 2022 01:36
Copy link
Member

@corona10 corona10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm :) Nice solution

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@gpshead gpshead merged commit 4a08c4c into python:main Mar 31, 2022
@miss-islington
Copy link
Contributor

Thanks @gpshead for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒⛏🤖

@gpshead gpshead deleted the subprocess-vfork-fail branch March 31, 2022 20:42
@miss-islington
Copy link
Contributor

Sorry, @gpshead, I could not cleanly backport this to 3.9 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 4a08c4c469d36f99d3a5e0f17ad82ab35dcf2835 3.9

@bedevere-bot
Copy link

GH-32219 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 31, 2022
…-32186)

bpo-47151: Fallback to fork when vfork fails in subprocess. An OS kernel can specifically decide to disallow vfork() in a process. No need for that to prevent us from launching subprocesses.
(cherry picked from commit 4a08c4c)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
@gpshead gpshead removed the needs backport to 3.9 only security fixes label Mar 31, 2022
miss-islington added a commit that referenced this pull request Mar 31, 2022
bpo-47151: Fallback to fork when vfork fails in subprocess. An OS kernel can specifically decide to disallow vfork() in a process. No need for that to prevent us from launching subprocesses.
(cherry picked from commit 4a08c4c)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
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.

7 participants