Skip to content

Commit

Permalink
Add note about use of force_ptr in futex implementation.
Browse files Browse the repository at this point in the history
Co-authored-by: Ralf Jung <post@ralfj.de>
  • Loading branch information
m-ou-se and RalfJung authored Oct 3, 2020
1 parent dfcb46a commit c268ee2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/shims/posix/linux/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ pub fn futex<'tcx>(

// The raw pointer value is used to identify the mutex.
// Not all mutex operations actually read from this address or even require this address to exist.
// This will make FUTEX_WAKE fail on an integer cast to a pointer. But FUTEX_WAIT on
// such a pointer can never work anyway, so that seems fine.
let futex_ptr = this.force_ptr(addr.to_scalar()?)?;

let thread = this.get_active_thread();
Expand Down

0 comments on commit c268ee2

Please sign in to comment.