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

A question regarding Miri error running the “sanitize" example under crossbeam-epoch. #1108

Open
lshi18 opened this issue May 8, 2024 · 0 comments

Comments

@lshi18
Copy link

lshi18 commented May 8, 2024

Hello, when I ran the sanitize example under crossbeam-epoch using Miri, I got an undefined behaviour error. As I am new to crossbeam, could you please offer some insight as to what could be the cause of the error? Thank you.

The command I used,

$ MIRIFLAGS="-Zmiri-symbolic-alignment-check -Zmiri-disable-isolation -Zmiri-tree-borrows" cargo miri run -p crossbeam-epoch --example sanitize

and the error,

error: Undefined Behavior: Data race detected between (1) atomic load on thread `unnamed-4` and (2) retag read of type `std::sync::atomic::AtomicUsize` on thread `unnamed-5` at alloc1563563. (2) just happened here
    --> /Users/lei.shi/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1008:9
     |
1008 |         Box(unsafe { Unique::new_unchecked(raw) }, alloc)
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) atomic load on thread `unnamed-4` and (2) retag read of type `std::sync::atomic::AtomicUsize` on thread `unnamed-5` at alloc1563563. (2) just happened here
     |
help: and (1) occurred earlier here
    --> crossbeam-epoch/examples/sanitize.rs:30:21
     |
30   |                     p.deref().load(Relaxed)
     |                     ^^^^^^^^^^^^^^^^^^^^^^^
     = help: overlapping atomic and non-atomic accesses must be synchronized, even if both are read-only
     = help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model
     = help: retags occur on all (re)borrows and as well as when references are copied or moved
     = help: retags permit optimizations that insert speculative reads or writes
     = help: therefore from the perspective of data races, a retag has the same implications as a read or write
     = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
     = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

Environment,

  • x86_64 apple mac laptop.
  • rust version: 1.79.0; toolchain: nightly-x86_64-apple-darwin
  • crossbeam-epoch v0.9.18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant