Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Synchronize asynchronous pipe reads and writes #95467

Merged
merged 3 commits into from
Apr 4, 2022

Conversation

ChrisDenton
Copy link
Member

@ChrisDenton ChrisDenton commented Mar 30, 2022

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
Collaborator

r? @Mark-Simulacrum

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 30, 2022
@joshtriplett
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Apr 4, 2022

📌 Commit 62f37da has been approved by joshtriplett

@bors bors 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
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.

Fixes rust-lang#95411
@Dylan-DPC
Copy link
Member

@bors r=joshtriplett

@bors
Copy link
Contributor

bors commented Apr 4, 2022

📌 Commit cbbcd87 has been approved by joshtriplett

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:master Apr 4, 2022
@rustbot rustbot 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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: 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