Skip to content

Leverage atomically setting CLOEXEC where possible #24237

Closed

Description

After #24034 lands we will be setting CLOEXEC on all file descriptors on unix in the standard library. Currently we do so in a nonatomic fashion, however, so it's possible to continue to leak file descriptors into children if a thread is concurrently forking.

Many platforms have methods of creating CLOEXEC file descriptors atomically, but many of the APIs are quite new and they need to be properly detected at runtime. For example, the current instances of fd.set_cloexec() that need to be migrated are listed below. A reminder of our minimum platform requirements are linux 2.6.18 and OSX 10.7.

The hard part about this bug is figuring out if it's possible to avoid compile-time detection of these functions (and instead rely on runtime detection).

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions