Skip to content

Conversation

hsfzxjy
Copy link

@hsfzxjy hsfzxjy commented Jul 19, 2025

1. DeduplicateStdioHandles() should mark the new handles inheritable

sys_fork_nt_parent() is directly passing std handles to child process. It would be a problem if those handles are non-inheritable.

2. Async IO on Windows might be synchronous

Even if the OVERLAPPED parameter supplied, IO functions like ReadFile/WriteFile may still complete their jobs before they return. In that case, the numberOfBytes result from the IO functions should be respected, and GetOverlappedResult should not be called.

WriteFile
Asynchronous disk I/O appears as synchronous on Windows

hsfzxjy added 2 commits July 20, 2025 00:56
The duplicated handles in DeduplicateStdioHandles() should
be inheritable. Otherwise sys_fork_nt_parent() will pass
non-inheritable handles to CreateProcess().
Even given OVERLAPPED, functions like ReadFile/WriteFile
still MAY complete before they return. In that case,
we should not call GetOverlappedResult, and should respect
the numberOfBytes output from the original IO function.
@github-actions github-actions bot added the libc label Jul 19, 2025
@hsfzxjy
Copy link
Author

hsfzxjy commented Jul 19, 2025

p.s. This PR fixes #913

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

Successfully merging this pull request may close these issues.

1 participant