Giter Club home page Giter Club logo

Comments (6)

tatsuya6502 avatar tatsuya6502 commented on June 7, 2024 1

p.s.

I ran miri test on my library and confirmed Miri no longer emits errors and warnings.

  • crossbeam-epoch: The current head of master branch #ce31c186.
  • Used -Zmiri-tree-borrows (#996)
  • macOS arm64 (aarch64-apple-darwin)

Cargo.toml

crossbeam-epoch = { git = "https://github.com/crossbeam-rs/crossbeam.git", branch = "master", optional = true }

Terminal Log

$ cargo tree -i crossbeam-epoch
crossbeam-epoch v0.9.15 (https://github.com/crossbeam-rs/crossbeam.git?branch=master#ce31c186)
└── moka v0.11.2 (...)

$ MIRIFLAGS="-Zmiri-tree-borrows" cargo +nightly miri test --lib cht::segment::tests::concurrent_overlapped_removal
Preparing a sysroot for Miri (target: aarch64-apple-darwin)... done
WARNING: Ignoring `RUSTC_WRAPPER` environment variable, Miri does not support wrapping.
    Finished test [unoptimized + debuginfo] target(s) in 0.08s
     Running unittests src/lib.rs (target/miri/aarch64-apple-darwin/debug/deps/moka-451ea5dfd08c9c07)

running 1 test
test cht::segment::tests::concurrent_overlapped_removal ... ^C

## Pressed Ctrl + C after ~1 minute. Otherwise it can take few hours to complete.

from crossbeam.

taiki-e avatar taiki-e commented on June 7, 2024

What platform did you run the test? (I'm thinking about #992)

from crossbeam.

tatsuya6502 avatar tatsuya6502 commented on June 7, 2024

macOS arm64

$ rustc +nightly -Vv
rustc 1.72.0-nightly (6bba06146 2023-06-16)
binary: rustc
commit-hash: 6bba061467f7c2cab04b262b95eb67bf89265587
commit-date: 2023-06-16
host: aarch64-apple-darwin
release: 1.72.0-nightly
LLVM version: 16.0.5

from crossbeam.

tatsuya6502 avatar tatsuya6502 commented on June 7, 2024

Thanks. Yeah. It seems #992 is related. I tried the following dependency and the error has changed.

crossbeam-epoch = { git = "https://github.com/crossbeam-rs/crossbeam.git", branch = "taiki-e/consume" }

So, Miri does not seem to understand load_consume impl.

Now it is detecting a stacked borrow violation...

error: Undefined Behavior: trying to retag from <221231> for SharedReadWrite permission at alloc96329[0x8], but that tag does not exist in the borrow stack for this location
   --> /Users/tatsuya/.cargo/git/checkouts/crossbeam-5d5b005504a37dac/39da3f8/crossbeam-epoch/src/internal.rs:552:9
    |
552 |         &*local_ptr
    |         ^^^^^^^^^^^
    |         |
    |         trying to retag from <221231> for SharedReadWrite permission at alloc96329[0x8], but that tag does not exist in the borrow stack for this location
    |         this error occurs as part of retag at alloc96329[0x0..0xb8]
    |
    = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
    = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <221231> was created by a SharedReadWrite retag at offsets [0x0..0x8]
   --> src/bin/main1.rs:64:21
    |
64  |         let guard = pin();
    |                     ^^^^^
    = note: BACKTRACE (of the first span):
    = note: inside `<crossbeam_epoch::internal::Local as crossbeam_epoch::sync::list::IsElement<crossbeam_epoch::internal::Local>>::element_of` at /Users/tatsuya/.cargo/git/checkouts/crossbeam-5d5b005504a37dac/39da3f8/crossbeam-epoch/src/internal.rs:552:9: 552:20
    = note: inside `<crossbeam_epoch::sync::list::Iter<'_, crossbeam_epoch::internal::Local, crossbeam_epoch::internal::Local> as std::iter::Iterator>::next` at /Users/tatsuya/.cargo/git/checkouts/crossbeam-5d5b005504a37dac/39da3f8/crossbeam-epoch/src/sync/list.rs:290:37: 290:53
    = note: inside `crossbeam_epoch::internal::Global::try_advance` at /Users/tatsuya/.cargo/git/checkouts/crossbeam-5d5b005504a37dac/39da3f8/crossbeam-epoch/src/internal.rs:237:22: 237:45
    = note: inside `crossbeam_epoch::internal::Global::collect` at /Users/tatsuya/.cargo/git/checkouts/crossbeam-5d5b005504a37dac/39da3f8/crossbeam-epoch/src/internal.rs:202:28: 202:51
    = note: inside `crossbeam_epoch::internal::Local::pin` at /Users/tatsuya/.cargo/git/checkouts/crossbeam-5d5b005504a37dac/39da3f8/crossbeam-epoch/src/internal.rs:436:17: 436:46
    = note: inside `crossbeam_epoch::LocalHandle::pin` at /Users/tatsuya/.cargo/git/checkouts/crossbeam-5d5b005504a37dac/39da3f8/crossbeam-epoch/src/collector.rs:81:18: 81:37
    = note: inside closure at /Users/tatsuya/.cargo/git/checkouts/crossbeam-5d5b005504a37dac/39da3f8/crossbeam-epoch/src/default.rs:40:26: 40:38
    = note: inside closure at /Users/tatsuya/.cargo/git/checkouts/crossbeam-5d5b005504a37dac/39da3f8/crossbeam-epoch/src/default.rs:60:23: 60:27
    = note: inside `std::thread::LocalKey::<crossbeam_epoch::LocalHandle>::try_with::<[closure@crossbeam_epoch::default::with_handle<[closure@crossbeam_epoch::pin::{closure#0}], crossbeam_epoch::Guard>::{closure#0}], crossbeam_epoch::Guard>` at /Users/tatsuya/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:270:16: 270:31
    = note: inside `crossbeam_epoch::default::with_handle::<[closure@crossbeam_epoch::pin::{closure#0}], crossbeam_epoch::Guard>` at /Users/tatsuya/.cargo/git/checkouts/crossbeam-5d5b005504a37dac/39da3f8/crossbeam-epoch/src/default.rs:59:5: 60:28
    = note: inside `crossbeam_epoch::pin` at /Users/tatsuya/.cargo/git/checkouts/crossbeam-5d5b005504a37dac/39da3f8/crossbeam-epoch/src/default.rs:40:5: 40:39
note: inside `tests::read_and_maybe_replace`
   --> src/bin/main1.rs:64:21
    |
64  |         let guard = pin();
    |                     ^^^^^

from crossbeam.

taiki-e avatar taiki-e commented on June 7, 2024

SB errors from epoch should be fixed in #871.

from crossbeam.

tatsuya6502 avatar tatsuya6502 commented on June 7, 2024

Wow! That was super quick. Thank you so much!

I tried epoch-fix-sb-violations branch and found that Miri no longer reports any errors and warnings on macOS arm64 🎉

$ rustc +nightly -Vv
rustc 1.72.0-nightly (6bba06146 2023-06-16)
binary: rustc
commit-hash: 6bba061467f7c2cab04b262b95eb67bf89265587
commit-date: 2023-06-16
host: aarch64-apple-darwin
release: 1.72.0-nightly
LLVM version: 16.0.5

$ cargo +nightly miri test --bin main1
Preparing a sysroot for Miri (target: aarch64-apple-darwin)... done
WARNING: Ignoring `RUSTC_WRAPPER` environment variable, Miri does not support wrapping.
    Finished test [unoptimized + debuginfo] target(s) in 0.04s
     Running unittests src/bin/main1.rs (target/miri/aarch64-apple-darwin/debug/deps/main1-5aa366f684d43212)

running 1 test
test tests::concurrent_read_and_modify ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

from crossbeam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.