]>
git.lizzy.rs Git - rust.git/log
Ben Kimock [Wed, 8 Dec 2021 03:05:13 +0000 (22:05 -0500)]
Cache lookups into the borrow stack
This adds a very simple LRU-like cache which stores the locations of
often-used tags. While the implementation is very simple, the cache hit
rate is incredible at ~99.9% on most programs, and often the element at
position 0 in the cache has a hit rate of 90%. So the sub-optimality of
this cache basicaly vanishes into the noise in a profile.
Additionally, we keep a range which denotes where there might be an item
granting Unique permission in the stack, so that when we invalidate
Uniques we do not need to scan much of the stack, and often scan nothing
at all.
bors [Fri, 1 Jul 2022 18:14:23 +0000 (18:14 +0000)]
Auto merge of #2299 - RalfJung:bsd, r=RalfJung
test more things on FreeBSD
Ralf Jung [Fri, 1 Jul 2022 18:13:36 +0000 (14:13 -0400)]
run data_race tests on bsd
Ralf Jung [Fri, 1 Jul 2022 18:12:25 +0000 (14:12 -0400)]
more current_dir tests for freebsd
bors [Fri, 1 Jul 2022 17:41:10 +0000 (17:41 +0000)]
Auto merge of #2298 - InfRandomness:shim-error, r=RalfJung
Add `__error` to freebsd shims
Signed-off-by: InfRandomness <infrandomness@gmail.com>
InfRandomness [Fri, 1 Jul 2022 16:52:32 +0000 (18:52 +0200)]
Add `current_dir_with_isolation` to freebsd tests list
Signed-off-by: InfRandomness <infrandomness@gmail.com>
InfRandomness [Fri, 1 Jul 2022 16:36:14 +0000 (18:36 +0200)]
Add `__error` to freebsd shims
Signed-off-by: InfRandomness <infrandomness@gmail.com>
bors [Fri, 1 Jul 2022 16:26:25 +0000 (16:26 +0000)]
Auto merge of #2297 - RalfJung:rustup, r=RalfJung
rustup
Ralf Jung [Fri, 1 Jul 2022 16:25:35 +0000 (12:25 -0400)]
make clippy happy
bors [Fri, 1 Jul 2022 14:46:30 +0000 (14:46 +0000)]
Auto merge of #2296 - RalfJung:miri-script, r=RalfJung
./miri improvements
I have needed to run something with many different seeds often enough that I would like an easier way to do it. ;) So now we have `./miri many-seeds`.
Also I made the script less dependent on the working directory, so calling it from a different directory should work properly now even if that other directory does not have the same rustup override as the one where Miri lives.
Ralf Jung [Fri, 1 Jul 2022 14:14:31 +0000 (10:14 -0400)]
rustup
Ralf Jung [Fri, 1 Jul 2022 14:01:00 +0000 (10:01 -0400)]
more tweaks
Ralf Jung [Fri, 1 Jul 2022 13:55:02 +0000 (09:55 -0400)]
add './miri many-seeds', and respect MIRIFLAGS in './miri run'
Ralf Jung [Fri, 1 Jul 2022 11:53:17 +0000 (07:53 -0400)]
make miri script work from other working directories
bors [Fri, 1 Jul 2022 02:24:51 +0000 (02:24 +0000)]
Auto merge of #2295 - RalfJung:better-alloc-tracking, r=RalfJung
allocation tracking: also print size, alignment, kind of the allocation
Ralf Jung [Thu, 30 Jun 2022 22:41:32 +0000 (18:41 -0400)]
allocation tracking: also print size, alignment, kind of the allocation
bors [Thu, 30 Jun 2022 15:15:20 +0000 (15:15 +0000)]
Auto merge of #2293 - RalfJung:env, r=RalfJung
make -Zmiri-env-forward take precedence over -Zmiri-env-exclude
Lets people experiment with the `TERM` env var.
Ralf Jung [Thu, 30 Jun 2022 15:13:26 +0000 (11:13 -0400)]
make -Zmiri-env-forward take precedence over -Zmiri-env-exclude
bors [Thu, 30 Jun 2022 14:05:32 +0000 (14:05 +0000)]
Auto merge of #2291 - RalfJung:no-std-is-minimal, r=RalfJung
use run_tests_minimal for the new no-std test
Ralf Jung [Thu, 30 Jun 2022 14:04:23 +0000 (10:04 -0400)]
use run_tests_minimal for the new no-std test
bors [Thu, 30 Jun 2022 13:16:57 +0000 (13:16 +0000)]
Auto merge of #2282 - rust-lang:no_std, r=RalfJung
Support no-std targets and test it in CI
cc `@jamesmunns`
This is a bit annoying as you need to have `MIRI_NO_STD=1` set at all times, but it works ™️
Once libstd's `restricted_std` feature becomes more usable, we can probably do away with that env var.
I also added a test to CI to make sure it keeps working. This test only builds libcore and runs a single test, so it's pretty fast.
Oli Scherer [Wed, 29 Jun 2022 13:29:35 +0000 (13:29 +0000)]
Support no-std targets and test it in CI
bors [Thu, 30 Jun 2022 02:18:34 +0000 (02:18 +0000)]
Auto merge of #2290 - RalfJung:snakessss, r=RalfJung
use Rust SnakeCase
Ralf Jung [Thu, 30 Jun 2022 02:17:46 +0000 (22:17 -0400)]
use Rust SnakeCase
bors [Thu, 30 Jun 2022 01:31:55 +0000 (01:31 +0000)]
Auto merge of #2289 - RalfJung:rustup, r=RalfJung
rustup
Ralf Jung [Thu, 30 Jun 2022 01:31:27 +0000 (21:31 -0400)]
rustup
bors [Wed, 29 Jun 2022 23:04:07 +0000 (23:04 +0000)]
Auto merge of #2287 - RalfJung:field-retagging, r=RalfJung
stacked borrows: add option for recursive field retagging
bors [Wed, 29 Jun 2022 22:39:57 +0000 (22:39 +0000)]
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.
Ralf Jung [Wed, 29 Jun 2022 21:56:47 +0000 (17:56 -0400)]
merge two SB test files
Ralf Jung [Wed, 29 Jun 2022 21:53:09 +0000 (17:53 -0400)]
add option for recursive field retagging
bors [Wed, 29 Jun 2022 22:21:30 +0000 (22:21 +0000)]
Auto merge of #2288 - RalfJung:clippy, r=RalfJung
add ./miri clippy
also make ui_test comply with clippy
Ralf Jung [Wed, 29 Jun 2022 22:17:28 +0000 (18:17 -0400)]
make ui_test pass clippy
Ralf Jung [Wed, 29 Jun 2022 22:14:41 +0000 (18:14 -0400)]
add ./miri clippy
Christian Legnitto [Wed, 29 Jun 2022 17:30:30 +0000 (13:30 -0400)]
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>
bors [Wed, 29 Jun 2022 17:18:00 +0000 (17:18 +0000)]
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`.
Christian Legnitto [Wed, 29 Jun 2022 17:14:30 +0000 (13:14 -0400)]
Update path to passing tests in CONTRIBUTING.md examples
This appears to be renamed from `tests/run-pass` to `tests/pass`.
bors [Wed, 29 Jun 2022 14:35:18 +0000 (14:35 +0000)]
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`
\e [0m\e [1m\e [38;5;9merror[E0277]\e [0m\e [0m\e [1m: `*mut std::sync::atomic::AtomicUsize` cannot be sent between threads safely\e [0m
\e [0m \e [0m\e [0m\e [1m\e [38;5;12m--> \e [0m\e [0msrc/main.rs:17:18\e [0m
\e [0m \e [0m\e [0m\e [1m\e [38;5;12m|\e [0m
\e [0m\e [1m\e [38;5;12m17\e [0m\e [0m \e [0m\e [0m\e [1m\e [38;5;12m|\e [0m\e [0m \e [0m\e [0m let j1 = spawn(move || {\e [0m
\e [0m \e [0m\e [0m\e [1m\e [38;5;12m| \e [0m\e [0m \e [0m\e [0m\e [1m\e [38;5;12m__________________\e [0m\e [0m\e [1m\e [38;5;9m^^^^^\e [0m\e [0m\e [1m\e [38;5;12m_-\e [0m
\e [0m \e [0m\e [0m\e [1m\e [38;5;12m| \e [0m\e [0m\e [1m\e [38;5;12m|\e [0m\e [0m \e [0m\e [0m\e [1m\e [38;5;9m|\e [0m
\e [0m \e [0m\e [0m\e [1m\e [38;5;12m| \e [0m\e [0m\e [1m\e [38;5;12m|\e [0m\e [0m \e [0m\e [0m\e [1m\e [38;5;9m`*mut std::sync::atomic::AtomicUsize` cannot be sent between threads safely\e [0m
\e [0m\e [1m\e [38;5;12m18\e [0m\e [0m \e [0m\e [0m\e [1m\e [38;5;12m|\e [0m\e [0m \e [0m\e [0m\e [1m\e [38;5;12m|\e [0m\e [0m \e [0m\e [0m *(c.0 as *mut usize) = 32;\e [0m
\e [0m\e [1m\e [38;5;12m19\e [0m\e [0m \e [0m\e [0m\e [1m\e [38;5;12m|\e [0m\e [0m \e [0m\e [0m\e [1m\e [38;5;12m|\e [0m\e [0m \e [0m\e [0m });\e [0m
\e [0m \e [0m\e [0m\e [1m\e [38;5;12m| \e [0m\e [0m\e [1m\e [38;5;12m|_________-\e [0m\e [0m \e [0m\e [0m\e [1m\e [38;5;12mwithin this `[closure@src/main.rs:17:24: 19:10]`\e [0m
\e [0m \e [0m\e [0m\e [1m\e [38;5;12m|\e [0m
```
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
Ralf Jung [Wed, 29 Jun 2022 14:14:26 +0000 (10:14 -0400)]
revert --color=always changes
bors [Wed, 29 Jun 2022 14:09:52 +0000 (14:09 +0000)]
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!
Ralf Jung [Wed, 29 Jun 2022 14:09:18 +0000 (10:09 -0400)]
fmt
Ralf Jung [Wed, 29 Jun 2022 13:33:12 +0000 (09:33 -0400)]
also prune caller_location frames when backtrace=off
Ralf Jung [Wed, 29 Jun 2022 13:31:11 +0000 (09:31 -0400)]
improve atomics test coverage
Ralf Jung [Wed, 29 Jun 2022 12:33:06 +0000 (08:33 -0400)]
rustup
bors [Tue, 28 Jun 2022 12:53:27 +0000 (12:53 +0000)]
Auto merge of #2280 - RalfJung:int2ptr, r=RalfJung
tweak int2ptr diagnostics
Ralf Jung [Tue, 28 Jun 2022 12:52:22 +0000 (08:52 -0400)]
tweak int2ptr diagnostics
bors [Tue, 28 Jun 2022 02:52:23 +0000 (02:52 +0000)]
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?...
Ralf Jung [Tue, 28 Jun 2022 02:11:09 +0000 (22:11 -0400)]
typo
Ralf Jung [Mon, 27 Jun 2022 15:16:27 +0000 (11:16 -0400)]
update getrandom
Ralf Jung [Mon, 27 Jun 2022 12:13:55 +0000 (08:13 -0400)]
finally we can actually have adjacent allocations :)
bors [Tue, 28 Jun 2022 01:53:06 +0000 (01:53 +0000)]
Auto merge of #2278 - RalfJung:rustup, r=RalfJung
Rustup
Ralf Jung [Tue, 28 Jun 2022 01:29:40 +0000 (21:29 -0400)]
rustup
Ralf Jung [Mon, 27 Jun 2022 15:09:28 +0000 (11:09 -0400)]
make use of get_alloc_info
bors [Tue, 28 Jun 2022 01:20:40 +0000 (01:20 +0000)]
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. :-) :tada: 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
Ralf Jung [Tue, 28 Jun 2022 00:22:50 +0000 (20:22 -0400)]
show int2ptr warning once for each span (but don't duplicate the long help)
Ralf Jung [Tue, 28 Jun 2022 00:04:46 +0000 (20:04 -0400)]
fix warning text
bors [Mon, 27 Jun 2022 17:40:15 +0000 (17:40 +0000)]
Auto merge of #2221 - InfRandomness:freebsd-target-support, r=RalfJung
Freebsd-target-support
Implement freebsd as a target for miri
Ralf Jung [Mon, 27 Jun 2022 17:38:32 +0000 (13:38 -0400)]
improve old comment
bors [Mon, 27 Jun 2022 15:46:19 +0000 (15:46 +0000)]
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...
Ralf Jung [Mon, 27 Jun 2022 15:44:45 +0000 (11:44 -0400)]
make sure a thread is joined
Ralf Jung [Mon, 27 Jun 2022 12:35:25 +0000 (08:35 -0400)]
typo
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
Ralf Jung [Mon, 27 Jun 2022 03:14:16 +0000 (23:14 -0400)]
avoid unnecessary indirection in miri-track-raw-pointers warning
Ralf Jung [Mon, 27 Jun 2022 03:00:54 +0000 (23:00 -0400)]
make macOS happy
Ralf Jung [Mon, 27 Jun 2022 02:27:38 +0000 (22:27 -0400)]
fmt
Ralf Jung [Mon, 27 Jun 2022 02:07:02 +0000 (22:07 -0400)]
readme: move some things around
Ralf Jung [Mon, 27 Jun 2022 02:01:03 +0000 (22:01 -0400)]
remove support for untagged pointers
good riddance!
Ralf Jung [Mon, 27 Jun 2022 01:26:14 +0000 (21:26 -0400)]
more int2ptr cast tests, and fix casting of addresses inside dead allocations
Ralf Jung [Mon, 27 Jun 2022 01:14:18 +0000 (21:14 -0400)]
make permissive provenance and raw-ptr tagging the default
infrandomness [Sun, 26 Jun 2022 23:22:13 +0000 (01:22 +0200)]
Cargo fmt
infrandomness [Sun, 26 Jun 2022 23:13:13 +0000 (01:13 +0200)]
Address code review
- Merge pthread_attr_getstack shim to unix/foreign_items.rs
Ralf Jung [Sun, 26 Jun 2022 20:20:37 +0000 (16:20 -0400)]
only test a few tests on FreeBSD
infrandomness [Sun, 12 Jun 2022 09:47:59 +0000 (11:47 +0200)]
Add `pthread_attr_get_np` shim
infrandomness [Sun, 12 Jun 2022 09:47:43 +0000 (11:47 +0200)]
Add `pthread_attr_getstack` shim
infrandomness [Fri, 10 Jun 2022 10:12:20 +0000 (12:12 +0200)]
Fix panicking ui_tests framework
infrandomness [Thu, 9 Jun 2022 14:50:34 +0000 (16:50 +0200)]
Fix pending reviews
infrandomness [Thu, 9 Jun 2022 14:06:07 +0000 (16:06 +0200)]
Initial freebsd work
bors [Sun, 26 Jun 2022 23:00:18 +0000 (23:00 +0000)]
Auto merge of #2274 - RalfJung:trophy, r=RalfJung
trophy case: add the data race in thread::scope
Ralf Jung [Sun, 26 Jun 2022 22:59:48 +0000 (18:59 -0400)]
trophy case: add the data race in thread::scope
bors [Sun, 26 Jun 2022 18:39:38 +0000 (18:39 +0000)]
Auto merge of #2272 - RalfJung:progress, r=RalfJung
add -Zmiri-report-progress to regularly print a stacktrace of what we are executing
Fixes https://github.com/rust-lang/miri/issues/910
The stacktrace is printed every N basic blocks. I picked the default (1 million) to take a few seconds on my machine, but it can be adjusted by the user.
Ralf Jung [Sun, 26 Jun 2022 16:31:53 +0000 (12:31 -0400)]
add -Zmiri-report-progress to regularly print a stacktrace of what we are executing
bors [Sun, 26 Jun 2022 03:54:43 +0000 (03:54 +0000)]
Auto merge of #2270 - RalfJung:futex-ordering, r=RalfJung
test that futexes induce appropriate synchronization
This fails when I remove the `validate_lock_acquire` or `validate_lock_release` from `futex_wake`. So finally we got those code paths actually covered in tests. :)
Ralf Jung [Sun, 26 Jun 2022 03:22:42 +0000 (23:22 -0400)]
test that futexes induce appropriate synchronization
bors [Sun, 26 Jun 2022 03:31:57 +0000 (03:31 +0000)]
Auto merge of #2269 - RalfJung:fmt, r=RalfJung
make a bunch of tests look more like how they did before rustfmt
Ralf Jung [Sun, 26 Jun 2022 03:30:29 +0000 (23:30 -0400)]
make a bunch of tests look more like how they did before rustfmt
bors [Sun, 26 Jun 2022 00:11:30 +0000 (00:11 +0000)]
Auto merge of #2245 - saethlin:color-always, r=RalfJung
Actually pass through the request for --color=always
https://github.com/rust-lang/miri/pull/2243 actually doesn't work :joy:
The suggestion to split on `,` was good but `arg` is actually the whole `--json=diagnostic-rendered-ansi,artifacts,future-incompat
`, and of course I didn't test that change locally and we have no test for this in CI.
Therefore, I would like some guidance on making a test for this because I'm going to rely on this working.
Ralf Jung [Sun, 26 Jun 2022 00:01:36 +0000 (20:01 -0400)]
don't assert the same thing twice
bors [Sat, 25 Jun 2022 23:52:34 +0000 (23:52 +0000)]
Auto merge of #2268 - RalfJung:not-unpin-protected, r=RalfJung
test that &mut !Unpin references are protected
Ralf Jung [Sat, 25 Jun 2022 23:15:11 +0000 (19:15 -0400)]
test that &mut !Unpin references are protected
bors [Sat, 25 Jun 2022 20:01:49 +0000 (20:01 +0000)]
Auto merge of #2267 - RalfJung:rustup, r=RalfJung
rustup
I cannot reproduce https://github.com/rust-lang/rust/issues/98493 so let's see what CI says.
Ralf Jung [Sat, 25 Jun 2022 19:45:45 +0000 (15:45 -0400)]
test for forgetting locked mutex
Ralf Jung [Sat, 25 Jun 2022 19:17:37 +0000 (15:17 -0400)]
join all the threads
Ralf Jung [Sat, 25 Jun 2022 19:06:53 +0000 (15:06 -0400)]
rustup
bors [Sat, 25 Jun 2022 16:29:38 +0000 (16:29 +0000)]
Auto merge of #2265 - RalfJung:readme, r=RalfJung
README: multi-seed loop: also test the 0 seed
Ralf Jung [Sat, 25 Jun 2022 16:27:50 +0000 (12:27 -0400)]
README: multi-seed loop: also test the 0 seed
bors [Sat, 25 Jun 2022 15:54:31 +0000 (15:54 +0000)]
Auto merge of #2264 - RalfJung:not-a-fixme, r=RalfJung
remove a FIXME that is not actually a bug
Ralf Jung [Sat, 25 Jun 2022 15:52:29 +0000 (11:52 -0400)]
remove a FIXME that is not actually a bug
Ben Kimock [Mon, 20 Jun 2022 19:16:32 +0000 (15:16 -0400)]
Actually pass through the request for --color=always
bors [Sat, 25 Jun 2022 02:05:18 +0000 (02:05 +0000)]
Auto merge of #2196 - carbotaniuman:permissive-stacked-borrows, r=RalfJung
Handle wildcard pointers in SB
This uses an permissive `Unknown` implementation, where a wildcard pointer (and any SRW derived from a wildcard pointer) can access any previously-exposed SB tag. This is missing any meaningful test-cases, and all of the edge-cases have not yet been worked through.
I think there's also some bugs here with differing Unknowns in different ranges and having things behave really weirdly too, alongside some issues with retagging to `SRO` or `Unique`.
Ralf Jung [Sat, 25 Jun 2022 02:02:17 +0000 (22:02 -0400)]
tweaks and feedback
Ralf Jung [Fri, 24 Jun 2022 23:45:35 +0000 (19:45 -0400)]
implement 'delimited' expose tracking so we still detect some UB
bors [Fri, 24 Jun 2022 23:24:57 +0000 (23:24 +0000)]
Auto merge of #2263 - wesleywiser:update_measureme, r=RalfJung
Update measureme to the latest version
The major version number is different due to changes to the on-disk recording format but the core API is the same and miri continues to build on the latest version.