You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I know this pipe is only used for process::ChildStd* so we (probably) get away with it in typical usage. Also the read2 method below this does the right thing by synchronizing reads.
rustbot
added
O-windows
Operating system: Windows
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
labels
Mar 28, 2022
…triplett
Windows: Synchronize asynchronous pipe reads and writes
On Windows, the pipes used for spawned processes are opened for asynchronous access but `read` and `write` are done using the standard methods that assume synchronous access. This means that the buffer (and variables on the stack) may be read/written to after the function returns.
This PR ensures reads/writes complete before returning. Note that this only applies to pipes we create and does not affect the standard file read/write methods.
Fixesrust-lang#95411
In src/sys/windows/pipe.rs a pipe is opened for asynchronous access (aka "overlapped mode").
rust/library/std/src/sys/windows/pipe.rs
Lines 51 to 55 in 2d37f38
However the read method for pipes is:
rust/library/std/src/sys/windows/pipe.rs
Lines 184 to 186 in 2d37f38
Where
inner
is aHandle
whose read method does not wait for the buffer to be filled:rust/library/std/src/sys/windows/handle.rs
Lines 76 to 100 in 2d37f38
As far as I know this pipe is only used for
process::ChildStd*
so we (probably) get away with it in typical usage. Also theread2
method below this does the right thing by synchronizing reads.Found while investigating #81357
@rustbot label +T-libs +O-windows
The text was updated successfully, but these errors were encountered: