Skip to content

Don't dup stdin & stderr as this can break some std io redicection code #25394

@jkotas

Description

@jkotas

From @TheLastRar on March 10, 2018 13:8

Consider a program that does the follow;

Create pipes and dup2 the write fd onto stdin, stderr,
Have a thread continually read the pipes until EOF is reached (at which point the thread will terminate).
Use coreclr.
...
Restore the original stdin, stderr,
Close the write fd of pipes,
Wait for the pipe reader thread to terminate.

As coreclr dups the fd for stdin & stderr, there is still a write fd for the pipe, meaning the read thread will never receive an EOF and the program to hang at the last step.

Copied from original issue: dotnet/coreclr#16880

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions