Skip to content

fork+exec fails to close other file descriptors #46

Open
@iCharlesHu

Description

@iCharlesHu

(manually cloned from iCharlesHu/Subprocess#44)

https://github.com/iCharlesHu/swift-experimental-subprocess/blob/7204d94bc468c0669a326fe584bf240e1eecbb2b/Sources/_SubprocessCShims/process_shims.c#L322

UNIX programs typically need to close all other open fds that they don't want to inherit into the child process after fork() but before execve(). This code fails to do so, this is security-relevant.

Implementation here: https://github.com/swiftlang/swift-sdk-generator/pull/156/files#diff-456340af052c33f5e1551237a5b2b7a6f20c374fea29d0d352c931b328a319a4R134-R140

Metadata

Metadata

Assignees

Labels

blockerShow stopping issues for 0.0.1bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions