Skip to content

Leak pthread_{mutex,rwlock}_t if it's dropped while locked. - #98194

Merged
bors merged 2 commits into
rust-lang:masterfrom
m-ou-se:leak-locked-pthread-mutex
Jun 25, 2022
Merged

Leak pthread_{mutex,rwlock}_t if it's dropped while locked.#98194
bors merged 2 commits into
rust-lang:masterfrom
m-ou-se:leak-locked-pthread-mutex

Conversation

@m-ou-se

Copy link
Copy Markdown
Member

Fixes#85434.

@m-ou-sem-ou-se added A-concurrency Area: Concurrency T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 17, 2022
@rust-highfive

Copy link
Copy Markdown
Contributor

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @kennytm

(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 Jun 17, 2022
@m-ou-se

Copy link
Copy Markdown
MemberAuthor

r? @Amanieu

@rust-highfiverust-highfive assigned Amanieu and unassigned kennytmJun 18, 2022
@Amanieu

Copy link
Copy Markdown
Member

Does this issue also apply to pthread_rwlock_t? If so then we should apply the same workaround there.

@m-ou-se

Copy link
Copy Markdown
MemberAuthor

Attempting to destroy an uninitialized read-write lock results in undefined behavior.

Yes. Updating the PR. :)

@m-ou-sem-ou-se added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 19, 2022
@Amanieu

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Jun 19, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit b4fe8f3 has been approved by Amanieu

@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 Jun 19, 2022
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jun 19, 2022
…r=Amanieu
Leak pthreax_mutex_t when it's dropped while locked.
Fixesrust-lang#85434.
@JohnTitorJohnTitor mentioned this pull request Jun 19, 2022
@JohnTitor

Copy link
Copy Markdown
Member

Failed in rollup: #98263 (comment)

error[E0425]: cannot find function `forget` in this scope
--> library/std/src/sys/unix/locks/pthread_rwlock.rs:27:13
|
27| forget(rwlock);
| ^^^^^^not found in this scope
|
help: consider importing one of these items
|
1| use core::intrinsics::forget;
|
1| use core::mem::forget;
|
1| use crate::intrinsics::forget;
|
1| use crate::mem::forget;
|

Missing import on macOS.
@bors r-

@borsbors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 19, 2022
@joshtriplettjoshtriplett changed the title Leak pthreax_mutex_t when it's dropped while locked.Leak pthread_mutex_t if it's dropped while locked.Jun 20, 2022
@m-ou-sem-ou-se changed the title Leak pthread_mutex_t if it's dropped while locked.Leak pthread_{mutex,rwlock}_t if it's dropped while locked.Jun 20, 2022
@m-ou-se
m-ou-seforce-pushed the leak-locked-pthread-mutex branch from b4fe8f3 to e642c59CompareJune 20, 2022 07:34
@m-ou-se

Copy link
Copy Markdown
MemberAuthor

@bors r=Amanieu

@bors

bors commented Jun 20, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit e642c59 has been approved by Amanieu

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 20, 2022
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jun 25, 2022
…r=Amanieu
Leak pthread_{mutex,rwlock}_t if it's dropped while locked.
Fixesrust-lang#85434.
@JohnTitorJohnTitor mentioned this pull request Jun 25, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 25, 2022
…askrgr
Rollup of 9 pull requests
Successful merges:
- rust-lang#96412 (Windows: Iterative `remove_dir_all`)
- rust-lang#98126 (Mitigate MMIO stale data vulnerability)
- rust-lang#98149 (Set relocation_model to Pic on emscripten target)
- rust-lang#98194 (Leak pthread_{mutex,rwlock}_t if it's dropped while locked.)
- rust-lang#98298 (Point to type parameter definition when not finding variant, method and associated item)
- rust-lang#98311 (Reverse folder hierarchy)
- rust-lang#98401 (Add tracking issues to `--extern` option docs.)
- rust-lang#98429 (Use correct substs in enum discriminant cast)
- rust-lang#98431 (Suggest defining variable as mutable on `&mut _` type mismatch in pats)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit ecefccd into rust-lang:masterJun 25, 2022
@rustbotrustbot added this to the 1.64.0 milestone Jun 25, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-concurrencyArea: ConcurrencyS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-libsRelevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Destroying locked Mutex in libstd triggers miri in safe code

7 participants

@m-ou-se@rust-highfive@Amanieu@bors@JohnTitor@kennytm@rustbot