Skip to content

Commit

Permalink
Add FIXME about type of addr 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 c268ee2 commit 68776d2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/shims/posix/linux/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pub fn futex<'tcx>(
this.memory.check_ptr_access(addr.to_scalar()?, Size::from_bytes(4), Align::from_bytes(4).unwrap())?;
// Read an `i32` through the pointer, regardless of any wrapper types.
// It's not uncommon for `addr` to be passed as another type than `*mut i32`, such as `*const AtomicI32`.
// FIXME: this fails if `addr` is not a pointer type.
let futex_val = this.read_scalar_at_offset(addr.into(), 0, this.machine.layouts.i32)?.to_i32()?;
if val == futex_val {
// The value still matches, so we block the trait make it wait for FUTEX_WAKE.
Expand Down

0 comments on commit 68776d2

Please sign in to comment.