Skip to content
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

std::process::unix: Command: Do not unwind past fork(), in child #80263

Closed
wants to merge 1 commit into from

Commits on Jan 27, 2021

  1. std::process::unix: Do not unwind past fork() in child

    Unwinding past fork() in the child causes whatever traps the unwind
    to return twice.  This is very strange and clearly not desirable.
    
    With the default behaviour of the thread library, this can even result
    in a panic in the child being transformed into zero exit status (ie,
    success) as seen in the parent!
    
    If unwinding reaches the fork point, the child should abort.
    
    Annotating the closure with #[unwind(aborts)] is not sufficiently
    stable right now, so we use catch_unwind.  This requires marking the
    closure UnwindSafe - which is fine regardless of the contents of the
    closure, since we abort on unwind and won't therefore touch anything
    the closure might have captured.
    
    Fixes rust-lang#79740.
    
    Signed-off-by: Ian Jackson <[email protected]>
    ijackson authored and Mark-Simulacrum committed Jan 27, 2021
    Configuration menu
    Copy the full SHA
    20e2172 View commit details
    Browse the repository at this point in the history