Skip to content

Windows: Synchronize asynchronous pipe reads and writes - #95467

Merged
bors merged 3 commits into
rust-lang:masterfrom
ChrisDenton:async-read-pipe
Apr 4, 2022
Merged

Windows: Synchronize asynchronous pipe reads and writes#95467
bors merged 3 commits into
rust-lang:masterfrom
ChrisDenton:async-read-pipe

Conversation

@ChrisDenton

@ChrisDentonChrisDenton commented Mar 30, 2022

Copy link
Copy Markdown
Member

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.

Fixes#95411

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 30, 2022
Comment threadlibrary/std/src/sys/windows/pipe.rs Outdated
@joshtriplett

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Apr 4, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 62f37da has been approved by joshtriplett

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 4, 2022
@joshtriplettjoshtriplett mentioned this pull request Apr 4, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 4, 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
@Dylan-DPCDylan-DPC mentioned this pull request Apr 4, 2022
@Dylan-DPC

Copy link
Copy Markdown
Member

@bors r=joshtriplett

@bors

bors commented Apr 4, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit cbbcd87 has been approved by joshtriplett

@Dylan-DPCDylan-DPC mentioned this pull request Apr 4, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 4, 2022
Rollup of 7 pull requests
Successful merges:
- rust-lang#92942 (stabilize windows_process_extensions_raw_arg)
- rust-lang#94817 (Release notes for 1.60.0)
- rust-lang#95343 (Reduce unnecessary escaping in proc_macro::Literal::character/string)
- rust-lang#95431 (Stabilize total_cmp)
- rust-lang#95438 (Add SyncUnsafeCell.)
- rust-lang#95467 (Windows: Synchronize asynchronous pipe reads and writes)
- rust-lang#95609 (Suggest borrowing when trying to coerce unsized type into `dyn Trait`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 4cbc003 into rust-lang:masterApr 4, 2022
@rustbotrustbot added this to the 1.62.0 milestone Apr 4, 2022
@ChrisDenton
ChrisDenton deleted the async-read-pipe branch April 5, 2022 01:33
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read of asynchronous pipe without synchronization

7 participants

@ChrisDenton@rust-highfive@joshtriplett@bors@Dylan-DPC@Mark-Simulacrum@rustbot