Skip to content

from_env causes io-unsafety in child processes #64

Open
@the8472

Description

@the8472

(copied from rust-lang/rust#113730 (comment))

These lines seem questionable:

jobserver-rs/src/unix.rs

Lines 152 to 153 in b4bc5db

drop(set_cloexec(read, true));
drop(set_cloexec(write, true));

They lead the fds not being available to child processes by default (unless reverted by Client::configure) but from_env_ext() does not remove the environment variables. Which means child processes are instructed to access file descriptor numbers for jobserver communication that aren't open anymore and may have been reopened to point to other files. This seems like a violation of IO-safety (rust-lang/rust#116059 (comment)).

Either cloexec shouldn't be set or the environment variables should also be removed and only be added back via configure.

Metadata

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