Commit Graph

6523 Commits

Author SHA1 Message Date
bors
5974e7d4a9 Auto merge of #2287 - RalfJung:field-retagging, r=RalfJung
stacked borrows: add option for recursive field retagging
2022-06-29 23:04:07 +00:00
bors
1b3332a0a6 Auto merge of #2286 - LegNeato:patch-2, r=RalfJung
Support `gettimeofday` on more than macos

This appears to be in linux and in openbsd as well:

* https://github.com/torvalds/linux/blob/master/lib/vdso/gettimeofday.c
* https://github.com/openbsd/src/blob/master/sys/sys/time.h#L439

Note that std currently says [different syscalls are used on mac vs linux](https://doc.rust-lang.org/std/time/struct.SystemTime.html#platform-specific-behavior) but this is not part of[ std's contract](https://doc.rust-lang.org/std/io/index.html#platform-specific-behavior) and third party code could call the syscall directly on different platforms.
2022-06-29 22:39:57 +00:00
Ralf Jung
955f961f83 merge two SB test files 2022-06-29 18:22:30 -04:00
Ralf Jung
c4e86e103e add option for recursive field retagging 2022-06-29 18:22:30 -04:00
bors
ccfb869e23 Auto merge of #2288 - RalfJung:clippy, r=RalfJung
add ./miri clippy

also make ui_test comply with clippy
2022-06-29 22:21:30 +00:00
Ralf Jung
e33efc7517 make ui_test pass clippy 2022-06-29 18:17:36 -04:00
Ralf Jung
02f8cb2d55 add ./miri clippy 2022-06-29 18:17:36 -04:00
Christian Legnitto
73a1a27a45 Support gettimeofday on more than macos
This appears to be in linux and in openbsd as well:

* https://github.com/torvalds/linux/blob/master/lib/vdso/gettimeofday.c
* https://github.com/openbsd/src/blob/master/sys/sys/time.h#L439

Co-authored-by: Ralf Jung <post@ralfj.de>
2022-06-29 17:48:04 -04:00
bors
328a8c7a1e Auto merge of #2285 - LegNeato:patch-1, r=RalfJung
Update path to passing tests in CONTRIBUTING.md examples

This appears to be renamed from `tests/run-pass` to `tests/pass`.
2022-06-29 17:18:00 +00:00
Christian Legnitto
ad549194f9
Update path to passing tests in CONTRIBUTING.md examples
This appears to be renamed from `tests/run-pass` to `tests/pass`.
2022-06-29 13:14:30 -04:00
bors
062b66066c Auto merge of #2283 - RalfJung:color, r=RalfJung
revert --color=always changes

They [cause problems](https://github.com/rust-lang/miri/issues/2277) and they completely break rendering on the playground:
```
   Compiling playground v0.0.1 (/playground)
    Finished dev [unoptimized + debuginfo] target(s) in 0.47s
     Running `/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-miri target/miri/x86_64-unknown-linux-gnu/debug/playground`
error[E0277]: `*mut std::sync::atomic::AtomicUsize` cannot be sent between threads safely
   --> src/main.rs:17:18
    |
17  |           let j1 = spawn(move || {
    |  __________________^^^^^_-
    | |                  |
    | |                  `*mut std::sync::atomic::AtomicUsize` cannot be sent between threads safely
18  | |             *(c.0 as *mut usize) = 32;
19  | |         });
    | |_________- within this `[closure@src/main.rs:17:24: 19:10]`
    |
```

Sorry `@saethlin,` I think we need to go back to start here and consider another solution.

Fixes https://github.com/rust-lang/miri/issues/2277
2022-06-29 14:35:18 +00:00
Ralf Jung
6f7c0c0a2a revert --color=always changes 2022-06-29 10:14:26 -04:00
bors
63d660540b Auto merge of #2281 - RalfJung:rustup, r=RalfJung
Rustup

Fix our stacktrace after https://github.com/rust-lang/rust/pull/98549. Now we can control whether `caller_location` should be pruned!
2022-06-29 14:09:52 +00:00
Ralf Jung
839c120b40 fmt 2022-06-29 10:09:18 -04:00
Ralf Jung
f389d46b04 also prune caller_location frames when backtrace=off 2022-06-29 09:33:12 -04:00
Ralf Jung
ea8dba411b improve atomics test coverage 2022-06-29 09:31:11 -04:00
Ralf Jung
28dea673be rustup 2022-06-29 08:33:06 -04:00
bors
29b1cc72fe Auto merge of #2280 - RalfJung:int2ptr, r=RalfJung
tweak int2ptr diagnostics
2022-06-28 12:53:27 +00:00
Ralf Jung
8bd4bbe3e4 tweak int2ptr diagnostics 2022-06-28 08:52:22 -04:00
bors
aaaed51ab8 Auto merge of #2279 - RalfJung:adjacent-allocs, r=RalfJung
Allow non-ZST allocations to be adjacent

Also `cargo update` in test-cargo-miri... no need to make a separate PR for that right?...
2022-06-28 02:52:23 +00:00
Ralf Jung
6549764960 typo 2022-06-27 22:52:02 -04:00
Ralf Jung
108fe3473c update getrandom 2022-06-27 22:52:02 -04:00
Ralf Jung
c16b380d6b finally we can actually have adjacent allocations :) 2022-06-27 22:52:02 -04:00
bors
aefaa5b6f0 Auto merge of #2278 - RalfJung:rustup, r=RalfJung
Rustup
2022-06-28 01:53:06 +00:00
Ralf Jung
ea30b6badd rustup 2022-06-27 21:29:40 -04:00
Ralf Jung
098704e10f make use of get_alloc_info 2022-06-27 21:22:46 -04:00
bors
7fafbde038 Auto merge of #2275 - RalfJung:permissive-provenance-for-all, r=RalfJung
Enable permissive provenance by default

This completes the plan laid out in https://github.com/rust-lang/miri/issues/2133:
- We use permissive provenance with wildcard pointers by default.
- We print a warning on int2ptr casts. `-Zmiri-permissive-provenance` suppresses the warning; `-Zmiri-strict-provenance` turns it into a hard error.
- Raw pointer tagging is now always enabled, so we remove the `-Zmiri-tag-raw-pointers` flag and the code for untagged pointers. (Passing the flag still works, for compatibility -- but we just ignore it, with a warning.)

We also fix an intptrcast issue:
- Only live allocations are considered when computing the AllocId from an address.

So, finally, Miri has a good story for ptr2int2ptr roundtrips *and* no weird false negatives when doing raw pointer stuff with Stacked Borrows. :-) 🎉   Thanks a lot to everyone who helped with this, in particular `@carbotaniuman` who convinced me this is even possible.

Fixes https://github.com/rust-lang/miri/issues/2133
Fixes https://github.com/rust-lang/miri/issues/1866
Fixes https://github.com/rust-lang/miri/issues/1993
2022-06-28 01:20:40 +00:00
Ralf Jung
c1eddbc7fe show int2ptr warning once for each span (but don't duplicate the long help) 2022-06-27 20:50:45 -04:00
Ralf Jung
67e89b53e2 fix warning text 2022-06-27 20:04:46 -04:00
bors
f5593de579 Auto merge of #2221 - InfRandomness:freebsd-target-support, r=RalfJung
Freebsd-target-support

Implement freebsd as a target for miri
2022-06-27 17:40:15 +00:00
Ralf Jung
5719897fb0
improve old comment 2022-06-27 13:38:32 -04:00
bors
99afff9dc1 Auto merge of #2276 - RalfJung:join, r=RalfJung
make sure a thread is joined

Not sure how that can fail given that preemption is disabled but whatever...
2022-06-27 15:46:19 +00:00
Ralf Jung
fb186a2f2d make sure a thread is joined 2022-06-27 11:44:45 -04:00
Ralf Jung
d9e7a3ae82 typo
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2022-06-27 09:08:56 -04:00
Ralf Jung
b479f092a8 avoid unnecessary indirection in miri-track-raw-pointers warning 2022-06-26 23:14:16 -04:00
Ralf Jung
3abec0e2af make macOS happy 2022-06-26 23:00:54 -04:00
Ralf Jung
1a5dfbeb7a fmt 2022-06-26 22:36:45 -04:00
Ralf Jung
4120425108 readme: move some things around 2022-06-26 22:19:56 -04:00
Ralf Jung
5c16713056 remove support for untagged pointers
good riddance!
2022-06-26 22:19:56 -04:00
Ralf Jung
294ef15adb more int2ptr cast tests, and fix casting of addresses inside dead allocations 2022-06-26 22:19:56 -04:00
Ralf Jung
13d425daeb make permissive provenance and raw-ptr tagging the default 2022-06-26 21:14:42 -04:00
infrandomness
aa072d72cc Cargo fmt 2022-06-27 01:39:25 +02:00
infrandomness
84a02787d8 Address code review
- Merge pthread_attr_getstack shim to unix/foreign_items.rs
2022-06-27 01:39:24 +02:00
Ralf Jung
aaa8ebb576 only test a few tests on FreeBSD 2022-06-27 01:39:24 +02:00
infrandomness
93c61f3905 Add pthread_attr_get_np shim 2022-06-27 01:39:24 +02:00
infrandomness
f2cbd3e2bc Add pthread_attr_getstack shim 2022-06-27 01:39:24 +02:00
infrandomness
e89b4d6df2 Fix panicking ui_tests framework 2022-06-27 01:39:24 +02:00
infrandomness
97a512070a Fix pending reviews 2022-06-27 01:39:24 +02:00
infrandomness
9130034337 Initial freebsd work 2022-06-27 01:39:24 +02:00
bors
4ce026fc1d Auto merge of #2274 - RalfJung:trophy, r=RalfJung
trophy case: add the data race in thread::scope
2022-06-26 23:00:18 +00:00