-
Notifications
You must be signed in to change notification settings - Fork 37
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
Update dependencies and fix unsoundness and CI failure #29
Conversation
Codecov Report
@@ Coverage Diff @@
## master #29 +/- ##
==========================================
- Coverage 91.00% 85.92% -5.08%
==========================================
Files 2 2
Lines 289 341 +52
==========================================
+ Hits 263 293 +30
- Misses 26 48 +22
Continue to review full report at Codecov.
|
Hmm, Miri reports UB, but this is a Stacked Borrows violation.
|
@taiki-e Thanks! How should I think about this miri error? Like a likely false positive, or as a likely bug? It's been a while since I looked at this code, so I totally believe that it might contain bugs, but don't want to page it all in if this has a high chance of being a false positive 😅 |
I read a bit of the code, but I think the problem is probably due to we mutably accessing the value that already immutably referenced (i.e., I think this is a bug): First, we get an immutable reference to the state: Lines 159 to 177 in 05f397e
Next, we are calling Lines 194 to 196 in 05f397e
Finally, drop the immutable reference that we first got. Dropping reference is a no-op. However, this tells the compiler that the reference is valid at least up to this line. Lines 204 to 207 in 05f397e
This can be fixed by removing |
Hmm, There is another Miri error. (This is likely not a bug).
I'm not sure what's happening, but I'll always get this error unless I disable all tests... 😅 |
Considering that the following code also causes an error, probably related to the thread spawned in #[test]
fn it_fails_when_full() {
let _x = bus::Bus::<bool>::new(1);
} Lines 301 to 305 in 05f397e
|
Ouch, that's a pretty significant limitation. What program captures all of its running threads! Not sure what is best to do about this. One might be to have a test-only constructor that returns the |
Yes: rust-lang/miri#1371 |
Thanks Ralf! Is there a way for us to disable that panic for the time being? I would like to do this update if possible, but not if it means miri won't run. |
I suppose we could add a flag which ignores "thread leaks" -- it would have to also disable the memory leak checker though since otherwise the stack and thread-local storage of that other thread would all be considered leaked. Do you have any idea what should happen wrt. thread-local destructors? Presumably they simply do not run for "leaked" threads? I do have some other patches I want to get done before the end of my vacation though, so I cannot promise a timeline. |
@RalfJung I believe Rust will actually run the destructors for thread-locals in all threads on |
That should be the destructors for the main thread... wouldn't it be unsound to run other thread's thread local destructors? They could be in use by that thread! Anyway that sounds more like a discussion for rust-lang/miri#1371 than for this issue. |
Any update on this by chance? There's now a vulnerability in the version of crossbeam-utils that this package depends on (crossbeam-rs/crossbeam#781) |
|
483911d
to
ae7de3f
Compare
afef3c9
to
365c3f4
Compare
- bash: yes | cargo miri -Zmiri-ignore-leaks test | ||
# disable preemption due to https://github.com/rust-lang/rust/issues/55005 | ||
# disable weak memory emulation due to https://github.com/rust-lang/miri/issues/2223 | ||
- bash: MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-ignore-leaks -Zmiri-preemption-rate=0 -Zmiri-disable-weak-memory-emulation" cargo miri test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to disable isolation now when that was not needed before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is needed for recv_timeout that uses Instant. (recv_timeout has only been tested at doc test, so that flag was not needed before.)
error: unsupported operation: `clock_gettime` not available when isolation is enabled
--> /home/vsts/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/time.rs:341:26
|
341 | cvt(unsafe { libc::clock_gettime(clock, t.as_mut_ptr()) }).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `clock_gettime` not available when isolation is enabled
|
= help: pass the flag `-Zmiri-disable-isolation` to disable isolation;
= help: or pass `-Zmiri-isolation-error=warn` to configure Miri to return an error code from isolated operations (if supported for that operation) and continue with a warning
= note: inside `std::sys::unix::time::inner::<impl std::sys::unix::time::Timespec>::now` at /home/vsts/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/time.rs:341:26
= note: inside `std::sys::unix::time::inner::Instant::now` at /home/vsts/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/time.rs:275:26
= note: inside `std::time::Instant::now` at /home/vsts/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/time.rs:276:17
note: inside `bus::BusReader::<bool>::recv_inner` at /home/vsts/work/1/s/src/lib.rs:587:47
--> /home/vsts/work/1/s/src/lib.rs:587:47
|
587 | RecvCondition::Timeout(_) => Some(time::Instant::now()),
| ^^^^^^^^^^^^^^^^^^^^
note: inside `bus::BusReader::<bool>::recv_timeout` at /home/vsts/work/1/s/src/lib.rs:762:9
--> /home/vsts/work/1/s/src/lib.rs:762:9
|
762 | self.recv_inner(RecvCondition::Timeout(timeout))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `main::_doctest_main_src_lib_rs_747_0` at src/lib.rs:12:44
--> src/lib.rs:756:44
|
12 | assert_eq!(Err(RecvTimeoutError::Timeout), rx.recv_timeout(timeout));
| ^^^^^^^^^^^^^^^^^^^^^^^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, makes sense.
Btw, the Futex issue is fixed in Miri (should ship with the next nightly).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing, thank you for following up on this after all this time ❤️
Released in 2.2.4 🎉 |
No description provided.