Skip to content

std::os::unix::process::CommandExt::exec should be unsafe #46775

Description

@Diggsey

This method assigns to environ outside of any lock, meaning that it's automatically unsafe for multi-threaded programs.

For single-threaded programs, if the exec fails, environ will point to memory that has been freed. The documentation gives a false sense of security:

The process may be in a "broken state" if this function returns in error. For example the working directory, environment variables, signal handling settings, various user/group information, or aspects of stdio file descriptors may have changed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-libs-api[DEPRECATED; DO NOT USE]

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions