]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agofmt
Ralf Jung [Mon, 30 May 2022 10:32:49 +0000 (12:32 +0200)]
fmt

2 years agodon't configure the same regex twice
Ralf Jung [Mon, 30 May 2022 10:28:13 +0000 (12:28 +0200)]
don't configure the same regex twice

2 years agoalso 'check' the test suite
Ralf Jung [Mon, 30 May 2022 10:20:12 +0000 (12:20 +0200)]
also 'check' the test suite

2 years agoprint reason for ignoring
Ralf Jung [Mon, 30 May 2022 08:31:12 +0000 (10:31 +0200)]
print reason for ignoring

2 years agoui_test: printing more consistent with compiletest
Ralf Jung [Mon, 30 May 2022 08:29:02 +0000 (10:29 +0200)]
ui_test: printing more consistent with compiletest

distinguish "ignored" from "filtered out"

2 years agotest mir-opt-level=4 again on run tests
Ralf Jung [Mon, 30 May 2022 08:28:07 +0000 (10:28 +0200)]
test mir-opt-level=4 again on run tests

2 years agoui_test: support multiple filters
Ralf Jung [Mon, 30 May 2022 08:27:41 +0000 (10:27 +0200)]
ui_test: support multiple filters

2 years agoAuto merge of #2158 - rust-lang:gesundheit, r=RalfJung
bors [Mon, 30 May 2022 07:52:48 +0000 (07:52 +0000)]
Auto merge of #2158 - rust-lang:gesundheit, r=RalfJung

Avoid error patterns matching themselves

fixes #2156
fixes https://github.com/rust-lang/miri/issues/2155

this will be obsolete the moment I extract that data from json diagnostics instead of just regexing the stderr.

2 years agoForward CARGO_BUILD_FLAGS to ui_test test suite
Oli Scherer [Mon, 30 May 2022 07:26:47 +0000 (07:26 +0000)]
Forward CARGO_BUILD_FLAGS to ui_test test suite

2 years agoAuto merge of #2162 - RalfJung:rustup, r=RalfJung
bors [Sun, 29 May 2022 12:07:14 +0000 (12:07 +0000)]
Auto merge of #2162 - RalfJung:rustup, r=RalfJung

rustup

Cc https://github.com/rust-lang/rust/issues/97486

2 years agorustup
Ralf Jung [Sun, 29 May 2022 12:06:35 +0000 (14:06 +0200)]
rustup

2 years agoAuto merge of #2161 - RalfJung:rustup, r=RalfJung
bors [Sun, 29 May 2022 06:34:31 +0000 (06:34 +0000)]
Auto merge of #2161 - RalfJung:rustup, r=RalfJung

rustup

Locally tests pass but rustc CI says they fail, let's see what happens...

Also clarify docs of cmpxchg_weak_failure_rate (Cc https://github.com/rust-lang/miri/issues/2160).

2 years agodisable optimized tests for now
Ralf Jung [Sun, 29 May 2022 06:25:36 +0000 (08:25 +0200)]
disable optimized tests for now

2 years agorustup
Ralf Jung [Sat, 28 May 2022 16:08:13 +0000 (18:08 +0200)]
rustup

2 years agoCommit our ui test crate's cargo lockfile
Oli Scherer [Fri, 27 May 2022 14:24:38 +0000 (14:24 +0000)]
Commit our ui test crate's cargo lockfile

2 years agoReintroduce path filters
Oli Scherer [Fri, 27 May 2022 11:43:14 +0000 (11:43 +0000)]
Reintroduce path filters

2 years agoDon't export private things
Oli Scherer [Fri, 27 May 2022 11:35:26 +0000 (11:35 +0000)]
Don't export private things

2 years agoSelf-descriptive verbosity
Oli Scherer [Wed, 25 May 2022 18:25:45 +0000 (18:25 +0000)]
Self-descriptive verbosity

2 years agoUse unit tests to keep private things private
Oli Scherer [Wed, 25 May 2022 18:24:55 +0000 (18:24 +0000)]
Use unit tests to keep private things private

2 years agoProperly name a test
Oli Scherer [Wed, 25 May 2022 17:58:45 +0000 (17:58 +0000)]
Properly name a test

2 years agoExplain `Comments::parse` arguments
Oli Scherer [Wed, 25 May 2022 17:53:39 +0000 (17:53 +0000)]
Explain `Comments::parse` arguments

2 years agoRun tests for ui_test together with miri test
Oli Scherer [Wed, 25 May 2022 17:48:03 +0000 (17:48 +0000)]
Run tests for ui_test together with miri test

2 years agoUpdate all tests
Oli Scherer [Wed, 25 May 2022 16:15:37 +0000 (16:15 +0000)]
Update all tests

2 years agoMake the file path of the failure more visible to be able to click it faster
Oli Scherer [Wed, 25 May 2022 16:15:31 +0000 (16:15 +0000)]
Make the file path of the failure more visible to be able to click it faster

2 years agoFix annotations matching themselves
Oli Scherer [Wed, 25 May 2022 16:11:37 +0000 (16:11 +0000)]
Fix annotations matching themselves

2 years agoReproduce #2156
Oli Scherer [Wed, 25 May 2022 16:08:41 +0000 (16:08 +0000)]
Reproduce #2156

2 years agoAuto merge of #2157 - RalfJung:tests, r=oli-obk
bors [Wed, 25 May 2022 17:39:53 +0000 (17:39 +0000)]
Auto merge of #2157 - RalfJung:tests, r=oli-obk

tweak new test suite output

- Make the entire "## Running ui tests ..." green, including the target.
- Fix double-space in `testname.rs  .. ok`.
- Make the final summary a bit more like compiletest-rs, in particular the newlines around it
- Use the term "ignored" consistently, rather than "skipped"

r? `@oli-obk`

2 years agotweak new test suite output
Ralf Jung [Wed, 25 May 2022 16:12:54 +0000 (18:12 +0200)]
tweak new test suite output

2 years agoAuto merge of #2151 - RalfJung:numbers, r=oli-obk
bors [Wed, 25 May 2022 14:35:06 +0000 (14:35 +0000)]
Auto merge of #2151 - RalfJung:numbers, r=oli-obk

enable number validity checking and ptr::invalid checking by default

This removes the `-Zmiri-check-number-validity` flag, enabling its effects by default. (We don't error when the flag is passed, for backwards compatibility.) We also enable by default that transmuting an integer to a pointer now creates a pointer with `None` provenance, which is invalid to dereference (and, in the case of a function pointer, invalid to call). I did this together since it is all related to ptr2int/int2ptr transmutation.

Two new flags are added to optionally take back these stricter checks:
- `-Zmiri-allow-uninit-numbers` makes Miri accept uninit data in integers and floats
- `-Zmiri-allow-ptr-int-transmute` makes Miri accept pointers (provenance data) in integers and floats, *and* makes Miri treat int2ptr transmutes as equivalent to a cast.

The flag names make sense IMO, but they are somewhat inconsistent with our existing flags since we usually call things `-Zmiri-disable-$CHECK` rather than `-Zmiri-allow-$THING`. But `-Zmiri-disable-uninit-number-check` sounds silly?

(Whenever I say "transmute" this includes union and pointer based type punning.)
Cc `@saethlin` I hope this won't break everything?^^ I think the most risky part is the int2ptr transmute aspect, in particular around function pointers where no `as` casts are possible. The correct pattern is to first cast to a raw ptr and then transmute that to a fn ptr. We should probably document this better, in the `transmute` documentation and maybe in the documentation for the `fn()` type. I should run this PR against the std test suite before we land it.
r? `@oli-obk`

- [x] Ensure stdlib docs recommend "usize -> raw ptr -> fn ptr" for int-to-fnptr casts: https://github.com/rust-lang/rust/pull/97321
- [x] Run the stdlib test suite

2 years agoenable number validity checking and ptr::invalid checking by default
Ralf Jung [Mon, 23 May 2022 13:44:27 +0000 (15:44 +0200)]
enable number validity checking and ptr::invalid checking by default

2 years agoAuto merge of #2032 - rust-lang:gesundheit, r=oli-obk
bors [Wed, 25 May 2022 13:41:29 +0000 (13:41 +0000)]
Auto merge of #2032 - rust-lang:gesundheit, r=oli-obk

Move test suite to ui tests and bless stderr output

fixes #2027

* [ ] //~ annotations should check that the error happens on their line
* [x] document all the things

2 years agoAdd a custom ui test runner and move all tests to it
Oli Scherer [Thu, 17 Mar 2022 13:49:10 +0000 (13:49 +0000)]
Add a custom ui test runner and move all tests to it

2 years agoAuto merge of #2153 - RalfJung:ptr-invalid, r=RalfJung
bors [Tue, 24 May 2022 15:51:23 +0000 (15:51 +0000)]
Auto merge of #2153 - RalfJung:ptr-invalid, r=RalfJung

with permissive-provenance set, we already treat ptr::invalid correctly

(same for strict provenance, but there it is not surprising)

2 years agowith permissive-provenance set, we already treat ptr::invalid correctly
Ralf Jung [Tue, 24 May 2022 15:49:11 +0000 (17:49 +0200)]
with permissive-provenance set, we already treat ptr::invalid correctly

2 years agoAuto merge of #2138 - JakobDegen:call-fallout, r=RalfJung
bors [Tue, 24 May 2022 15:17:33 +0000 (15:17 +0000)]
Auto merge of #2138 - JakobDegen:call-fallout, r=RalfJung

Adjust Miri to also require return places everywhere

This is the miri side of rust-lang/rust#96098 . It'll still need a bump to rust-version once the rust PR is merged, but the test suite passes against my local build of rustc.

2 years agorustp
Ralf Jung [Tue, 24 May 2022 15:16:03 +0000 (17:16 +0200)]
rustp

2 years agoAdjust Miri to also require return places everywhere
Jakob Degen [Sat, 21 May 2022 03:08:32 +0000 (23:08 -0400)]
Adjust Miri to also require return places everywhere

2 years agoAuto merge of #2152 - RalfJung:rustup, r=RalfJung
bors [Mon, 23 May 2022 18:02:34 +0000 (18:02 +0000)]
Auto merge of #2152 - RalfJung:rustup, r=RalfJung

rustup

On macOS the timing tests [failed again](https://github.com/rust-lang/miri/runs/6557930217?check_suite_focus=true), so let's give them even more slack.

2 years agorustup
Ralf Jung [Mon, 23 May 2022 15:35:36 +0000 (17:35 +0200)]
rustup

2 years agoAuto merge of #2150 - RalfJung:rustup, r=RalfJung
bors [Mon, 23 May 2022 10:39:51 +0000 (10:39 +0000)]
Auto merge of #2150 - RalfJung:rustup, r=RalfJung

Rustup

In particular, this contains https://github.com/rust-lang/rust/pull/97219. Miri support for actually erroring on misuse of `ptr::invalid` will happen later.

Also move some more tests to better locations.

2 years agorustup
Ralf Jung [Mon, 23 May 2022 10:37:48 +0000 (12:37 +0200)]
rustup

2 years agomove some tests to more suitable locations
Ralf Jung [Mon, 23 May 2022 10:19:42 +0000 (12:19 +0200)]
move some tests to more suitable locations

2 years agoAuto merge of #2149 - RalfJung:tests, r=RalfJung
bors [Mon, 23 May 2022 09:43:35 +0000 (09:43 +0000)]
Auto merge of #2149 - RalfJung:tests, r=RalfJung

move some compile-fail tests to a more appropriate location

These are testing validity invariants, after all.

2 years agomove some compile-fail tests to a more appropriate location
Ralf Jung [Mon, 23 May 2022 09:27:20 +0000 (11:27 +0200)]
move some compile-fail tests to a more appropriate location

2 years agoAuto merge of #2147 - RalfJung:readme, r=RalfJung
bors [Mon, 23 May 2022 09:25:16 +0000 (09:25 +0000)]
Auto merge of #2147 - RalfJung:readme, r=RalfJung

split flag section into common and advanced flags

As discussed with `@oli-obk` . However I was not always sure which flags to put where, so if you think some flags should be in the other category please let me know. :)

2 years agofix some old typos
Ralf Jung [Mon, 23 May 2022 09:24:08 +0000 (11:24 +0200)]
fix some old typos

2 years agoAuto merge of #2148 - RalfJung:compare-exchange-weak-failure-rate-test, r=RalfJung
bors [Mon, 23 May 2022 08:29:51 +0000 (08:29 +0000)]
Auto merge of #2148 - RalfJung:compare-exchange-weak-failure-rate-test, r=RalfJung

test that compare-exchange-weak-failure-rate=0.0 means what it says

Adds a test for https://github.com/rust-lang/miri/pull/2105

2 years agotest that compare-exchange-weak-failure-rate=0.0 means what it says
Ralf Jung [Mon, 23 May 2022 08:28:46 +0000 (10:28 +0200)]
test that compare-exchange-weak-failure-rate=0.0 means what it says

2 years agosplit flag section into common and advanced flags
Ralf Jung [Mon, 23 May 2022 08:15:34 +0000 (10:15 +0200)]
split flag section into common and advanced flags

2 years agoAuto merge of #2146 - RalfJung:int2ptr, r=RalfJung
bors [Mon, 23 May 2022 08:07:43 +0000 (08:07 +0000)]
Auto merge of #2146 - RalfJung:int2ptr, r=RalfJung

clean up int2ptr code a bit

Follow-up to https://github.com/rust-lang/miri/pull/2059

2 years agoclean up int2ptr code a bit
Ralf Jung [Mon, 23 May 2022 07:17:04 +0000 (09:17 +0200)]
clean up int2ptr code a bit

2 years agoAuto merge of #2059 - carbotaniuman:master, r=RalfJung
bors [Mon, 23 May 2022 07:24:33 +0000 (07:24 +0000)]
Auto merge of #2059 - carbotaniuman:master, r=RalfJung

Initial work on Miri permissive-exposed-provenance

Miri portions of the changes for portions of a permissive ptr-to-int model for Miri. This is more restrictive than what we currently have so it will probably need a flag once I figure out how to hook that up.

> This implements a form of permissive exposed-address provenance, wherein the only way to expose the address is with a cast to usize (ideally expose_addr). This is more restrictive than C in that stuff like reading the representation bytes (via unions, type-punning, transmute) does not expose the address, only expose_addr. This is less restrictive than C in that a pointer casted from an integer has union provenance of all exposed pointers, not any udi stuff.

There's a few TODOs here, namely related to `fn memory_read` and friends. We pass it the maybe/unreified provenance before `ptr_get_alloc` reifies it into a concrete one, so it doesn't have the `AllocId` (or the SB tag, but that's getting ahead of ourselves). One way this could be fixed is changing `ptr_get_alloc` and (`ptr_try_get_alloc_id` on the rustc side) to return a pointer with the tag fixed up. We could also take in different arguments, but I'm not sure what works best.

The other TODOs here are how permissive this model could be. This currently does not enforce that a ptr-to-int cast happens before the corresponding int-to-ptr (colloquial meaning of happens before, not atomic meaning). Example:

```
let ptr = 0x2000 as *const i32;
let a: i32 = 5;
let a_ptr = &a as *const i32;

// value is 0x2000;
a_ptr as usize;

println!("{}", unsafe { *ptr }); // this is valid
```

We also allow the resulting pointer to dereference different non-contiguous allocations (the "not any udi stuff" mentioned above), which I'm not sure if is allowed by LLVM.

This is the Miri side of https://github.com/rust-lang/rust/pull/95826.

2 years agoreadme: document permissive-provenance flag
Ralf Jung [Mon, 23 May 2022 07:03:06 +0000 (09:03 +0200)]
readme: document permissive-provenance flag

2 years agoInitial work on permissive provenance
carbotaniuman [Sun, 22 May 2022 20:22:05 +0000 (15:22 -0500)]
Initial work on permissive provenance

2 years agoAuto merge of #2105 - thomcc:flip-failure-rate, r=RalfJung
bors [Mon, 23 May 2022 07:03:49 +0000 (07:03 +0000)]
Auto merge of #2105 - thomcc:flip-failure-rate, r=RalfJung

Fix backwards `cmpxchg_weak_failure_rate` check

Uh, I guess I got this backwards a long time ago 😓.

2 years agoAuto merge of #2139 - saethlin:lazy-current-span, r=RalfJung
bors [Mon, 23 May 2022 06:46:46 +0000 (06:46 +0000)]
Auto merge of #2139 - saethlin:lazy-current-span, r=RalfJung

Factor current-span logic into a caching handle

After https://github.com/rust-lang/miri/pull/2030 and while working on https://github.com/rust-lang/miri/pull/1935 it became quite clear that we need to do some caching here, because some retag operations generate many calls to `log_invalidation`, and would thus search the current thread's stack _many_ times for a local crate. This caching fixes that. This handle type also has the nice benefit of tucking away all the `ThreadManager` + `CrateNum` logic.

2 years agoFix backwards `cmpxchg_weak_failure_rate` check
Thom Chiovoloni [Sat, 7 May 2022 17:37:20 +0000 (10:37 -0700)]
Fix backwards `cmpxchg_weak_failure_rate` check

2 years agoFactor current-span logic into a lazy caching handle
Ben Kimock [Wed, 8 Dec 2021 03:05:13 +0000 (22:05 -0500)]
Factor current-span logic into a lazy caching handle

2 years agoAuto merge of #2144 - matthiaskrgr:stderrfix, r=RalfJung
bors [Sun, 22 May 2022 20:00:17 +0000 (20:00 +0000)]
Auto merge of #2144 - matthiaskrgr:stderrfix, r=RalfJung

mute_stdout_stderr: mute stderr instead of stdin

should fix #2143

note: this is entirely untested, I was getting tons of errors on `cargo test` because of some missing setup.
I hope that CI can tell me if this works or not :see_no_evil:

r? `@oli-obk`

2 years agoshims: fs: silence stderr instead of stdout.
Matthias Krüger [Sun, 22 May 2022 19:54:00 +0000 (21:54 +0200)]
shims: fs: silence stderr instead of stdout.

Fixes #2143

2 years ago[NFC] shims: fs: fmt
Matthias Krüger [Sun, 22 May 2022 19:47:44 +0000 (21:47 +0200)]
[NFC] shims: fs: fmt

2 years agoAuto merge of #2141 - saethlin:early-diagnostics-ice, r=RalfJung
bors [Sun, 22 May 2022 16:17:17 +0000 (16:17 +0000)]
Auto merge of #2141 - saethlin:early-diagnostics-ice, r=RalfJung

Adjust diagnostics assertion so we don't ICE in setup

Fixes https://github.com/rust-lang/miri/issues/2076 just by handling diagnostics produced during setup. The tracking notes don't have any spans but it's better than an ICE.

It looks like we leak allocations 1..20, and allocations 13..19 don't have any creation notes, and 14 only has a `FreedAlloc` alloc tracking diagnostic.

2 years agotweak comment
Ralf Jung [Sun, 22 May 2022 16:16:59 +0000 (18:16 +0200)]
tweak comment

2 years agoHandle diagnotics emitted in runtime initialization
Ben Kimock [Sat, 21 May 2022 16:14:17 +0000 (12:14 -0400)]
Handle diagnotics emitted in runtime initialization

2 years agoAuto merge of #2142 - saethlin:cleanup-data-race-ice, r=oli-obk
bors [Sun, 22 May 2022 06:18:29 +0000 (06:18 +0000)]
Auto merge of #2142 - saethlin:cleanup-data-race-ice, r=oli-obk

Make allow_data_races_* public and use it during EnvVars::cleanup

Fixes https://github.com/rust-lang/miri/issues/2020

I've tried for hours now to come up with a test case for this ICE with no luck. I suspect there's something about the way the data race detection works under these conditions that I just don't understand :weary:.

But I tried this change out on a handful of crates and I don't see any more ICEs of this form. For whatever reason it seems like `bastion==0.4.5` is a good way to run into this, with the flags
```
MIRIFLAGS="-Zmiri-tag-raw-pointers -Zmiri-panic-on-unsupported -Zmiri-disable-isolation" cargo +miri miri test --no-fail-fast --doc
```
I think all the cases I've run into with this involve both `-Zmiri-panic-on-unsupported` and `-Zmiri-tag-raw-pointers`, so it could be that the combination of an unexpected panic and a machine halt is required.

2 years agoAuto merge of #2140 - V0ldek:page_size, r=RalfJung
bors [Sun, 22 May 2022 05:59:39 +0000 (05:59 +0000)]
Auto merge of #2140 - V0ldek:page_size, r=RalfJung

Update GetSystemInfo to work with `page_size` (#2136)

- Change logic in GetSystemInfo shim to take into account the two possible layouts of `SYSTEM_INFO`, the first-field-is-union used by [winapi::um::sysinfoapi::SYSTEM_INFO](https://docs.rs/winapi/latest/winapi/um/sysinfoapi/struct.SYSTEM_INFO.html), and first-two-fields-are-inlined-union used by [num_cpus](https://github.com/seanmonstar/num_cpus/blob/5f1b03332000b4c4274b5bd35fac516049ff1c6b/src/lib.rs#L206).
- Fill out the `dwPageSize` field with the `PAGE_SIZE` constant of `4096`.

Closes #2136

2 years agocomment on test
Ralf Jung [Sun, 22 May 2022 05:59:18 +0000 (07:59 +0200)]
comment on test

2 years agoUse precomputed layouts.
Mateusz Gienieczko [Sat, 21 May 2022 23:01:12 +0000 (01:01 +0200)]
Use precomputed layouts.

2 years agoAdd `i16` and `u16` primitive layout.
Mateusz Gienieczko [Sat, 21 May 2022 23:00:59 +0000 (01:00 +0200)]
Add `i16` and `u16` primitive layout.

2 years agoFix comment formatting.
Mateusz Gienieczko [Sat, 21 May 2022 22:59:49 +0000 (00:59 +0200)]
Fix comment formatting.

2 years agoDynamic offset calculation in GetSystemInfo.
Mateusz Gienieczko [Sat, 21 May 2022 19:42:25 +0000 (21:42 +0200)]
Dynamic offset calculation in GetSystemInfo.

2 years agoMake allow_data_races_* public to silence data races during cleanup
Ben Kimock [Sat, 21 May 2022 17:37:41 +0000 (13:37 -0400)]
Make allow_data_races_* public to silence data races during cleanup

2 years agoChange GetSystemInfo to explicit offset.
Mateusz Gienieczko [Sat, 21 May 2022 17:44:12 +0000 (19:44 +0200)]
Change GetSystemInfo to explicit offset.

2 years agoSet page size in GetSystemInfo.
Mateusz Gienieczko [Sat, 21 May 2022 16:17:25 +0000 (18:17 +0200)]
Set page size in GetSystemInfo.

2 years agoAuto merge of #2137 - RalfJung:targets, r=oli-obk
bors [Sat, 21 May 2022 16:15:49 +0000 (16:15 +0000)]
Auto merge of #2137 - RalfJung:targets, r=oli-obk

explain which targets we support to what extent

This is basically documenting my policy so far: Linux is the target I know best and can spend most time on. Apple is so close to Linux that it can basically ride along without much extra work. I don't have a lot of time to spend on our Windows support.

Of course, if people commit to contributing and maintaining support for a target, we can promise more than what is documented here. :)  But this is what I am willing to promise.

Also reduce the amount of work we do on the Windows test runner, since that one currently takes 10min longer than the other two.

r? `@oli-obk`

2 years agoAdd failing page_size test.
Mateusz Gienieczko [Sat, 21 May 2022 14:10:08 +0000 (16:10 +0200)]
Add failing page_size test.

2 years agorefresh our GHA caches
Ralf Jung [Sat, 21 May 2022 07:33:47 +0000 (09:33 +0200)]
refresh our GHA caches

2 years agoexplain which targets we support to what extent
Ralf Jung [Fri, 20 May 2022 21:36:35 +0000 (23:36 +0200)]
explain which targets we support to what extent

2 years agothe Windows CI runner takes a lot longer than the others; let it do less work
Ralf Jung [Fri, 20 May 2022 21:35:42 +0000 (23:35 +0200)]
the Windows CI runner takes a lot longer than the others; let it do less work

x86_64-apple-darwin is also used as the host OS for the macOS runner, so no need
to test it twice.

2 years agoexplain what we mean by 'unsound'
Ralf Jung [Fri, 20 May 2022 21:35:31 +0000 (23:35 +0200)]
explain what we mean by 'unsound'

2 years agoAuto merge of #2135 - RalfJung:rustup, r=RalfJung
bors [Fri, 20 May 2022 16:38:24 +0000 (16:38 +0000)]
Auto merge of #2135 - RalfJung:rustup, r=RalfJung

rustup

2 years agorustup
Ralf Jung [Fri, 20 May 2022 16:11:31 +0000 (18:11 +0200)]
rustup

2 years agoAuto merge of #2130 - RalfJung:rustup, r=RalfJung
bors [Fri, 20 May 2022 06:09:13 +0000 (06:09 +0000)]
Auto merge of #2130 - RalfJung:rustup, r=RalfJung

rustup

`Display` of `Ref`/`RefMut` was broken by https://github.com/rust-lang/rust/pull/97027, let's deref them to use the underlying reference `Display`.

Cc https://github.com/rust-lang/rust/issues/97204

2 years agorustup
Ralf Jung [Fri, 20 May 2022 06:08:11 +0000 (08:08 +0200)]
rustup

2 years agoAuto merge of #2128 - saethlin:fix-creation-range, r=RalfJung
bors [Thu, 19 May 2022 15:08:22 +0000 (15:08 +0000)]
Auto merge of #2128 - saethlin:fix-creation-range, r=RalfJung

Pass the correct size to the AllocRange for log_creation

Fixes https://github.com/rust-lang/miri/issues/2127

I guess all I needed was a bit of sleep and reassurance that this diagnostic is the wrong part of that situation.

2 years agoPass the correct size to the AllocRange for log_creation
Ben Kimock [Thu, 19 May 2022 13:29:08 +0000 (09:29 -0400)]
Pass the correct size to the AllocRange for log_creation

2 years agoAuto merge of #2125 - RalfJung:ref-validity, r=RalfJung
bors [Wed, 18 May 2022 06:34:48 +0000 (06:34 +0000)]
Auto merge of #2125 - RalfJung:ref-validity, r=RalfJung

test for validity of references pointing to uninhabited types

The new tests for https://github.com/rust-lang/rust/pull/97116

2 years agorustup
Ralf Jung [Wed, 18 May 2022 06:33:10 +0000 (08:33 +0200)]
rustup

2 years agochange one of the ref-to-uninhbaited tests to Box
Ralf Jung [Wed, 18 May 2022 06:32:08 +0000 (08:32 +0200)]
change one of the ref-to-uninhbaited tests to Box

2 years agotest for validity of references pointing to uninhabited types
Ralf Jung [Tue, 17 May 2022 15:36:34 +0000 (17:36 +0200)]
test for validity of references pointing to uninhabited types

2 years agoAuto merge of #2126 - RalfJung:typo, r=RalfJung
bors [Tue, 17 May 2022 16:59:56 +0000 (16:59 +0000)]
Auto merge of #2126 - RalfJung:typo, r=RalfJung

I cannot type

2 years agoI cannot type
Ralf Jung [Tue, 17 May 2022 16:59:27 +0000 (18:59 +0200)]
I cannot type

2 years agoAuto merge of #2124 - RalfJung:rustup-toolchain, r=RalfJung
bors [Tue, 17 May 2022 13:40:16 +0000 (13:40 +0000)]
Auto merge of #2124 - RalfJung:rustup-toolchain, r=RalfJung

rustup-toolchain: also prepare toolchain for vscode

This is a work-around for https://github.com/rust-lang/cargo/issues/10096.

2 years agorustup-toolchain: also prepare toolchain for vscode
Ralf Jung [Tue, 17 May 2022 13:36:59 +0000 (15:36 +0200)]
rustup-toolchain: also prepare toolchain for vscode

2 years agoAuto merge of #2122 - RalfJung:rustup, r=RalfJung
bors [Sun, 15 May 2022 10:58:41 +0000 (10:58 +0000)]
Auto merge of #2122 - RalfJung:rustup, r=RalfJung

rustup

I am on mobile and so I couldn't test this... let's see how it goes. ;)

2 years agorustup
Ralf Jung [Sun, 15 May 2022 10:56:39 +0000 (12:56 +0200)]
rustup

2 years agoAuto merge of #2121 - RalfJung:less-ice, r=RalfJung
bors [Sun, 15 May 2022 08:27:43 +0000 (08:27 +0000)]
Auto merge of #2121 - RalfJung:less-ice, r=RalfJung

don't ICE when libcore is missing

Fixes https://github.com/rust-lang/miri/issues/2120

2 years agodon't ICE when libcore is missing
Ralf Jung [Sun, 15 May 2022 08:26:47 +0000 (10:26 +0200)]
don't ICE when libcore is missing

2 years agoAuto merge of #2116 - carbotaniuman:minimal-miri-changes, r=RalfJung
bors [Sun, 15 May 2022 07:11:51 +0000 (07:11 +0000)]
Auto merge of #2116 - carbotaniuman:minimal-miri-changes, r=RalfJung

Minimal miri changes for rustc permissive provenance

Simple no-op changes to adapt to new API surface.

2 years agoAuto merge of #2030 - saethlin:track-alloc-history, r=oli-obk
bors [Sat, 14 May 2022 19:27:04 +0000 (19:27 +0000)]
Auto merge of #2030 - saethlin:track-alloc-history, r=oli-obk

Print spans where tags are created and invalidated

5225225 called this "automatic tag tracking" and I think that may be a reasonable description, but I would like to kill tag tracking as a primary use of Miri if possible. Tag tracking isn't always possible; for example if the UB is only detected with isolation off and the failing tag is made unstable by removing isolation. (also it's bad UX to run the tool twice)

This is just one of the things we can do with https://github.com/rust-lang/miri/pull/2024

The memory usage of this is _shockingly_ low, I think because the memory usage of Miri is driven by allocations where each byte ends up with its own very large stack. The memory usage in this change is linear with the number of tags, not tags * bytes. If memory usage gets out of control we can cap the number of events we save per allocation, from experience we tend to only use the most recent few in diagnostics but of course there's no guarantee of that so if we can manage to keep everything that would be best.

In many cases now I can tell exactly what these codebases are doing wrong just from the new outputs here, which I think is extremely cool.

New helps generated with plain old `cargo miri test` on `rust-argon2` v1.0.0:
```
test argon2::tests::single_thread_verification_multi_lane_hash ... error: Undefined Behavior: trying to reborrow <1485898> for Unique permission at alloc110523[0x0], but that tag does not exist in the borrow stack for this location
   --> /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/mem/manually_drop.rs:89:9
    |
89  |         slot.value
    |         ^^^^^^^^^^
    |         |
    |         trying to reborrow <1485898> for Unique permission at alloc110523[0x0], but that tag does not exist in the borrow stack for this location
    |         this error occurs as part of a reborrow at alloc110523[0x0..0x20]
    |
    = help: this indicates a potential bug in the program: it performed an invalid operation, but the 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: <1485898> was created by a retag at offsets [0x0..0x20]
   --> src/memory.rs:42:13
    |
42  |             vec.push(unsafe { &mut (*ptr) });
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: <1485898> was later invalidated at offsets [0x0..0x20]
   --> src/memory.rs:42:31
    |
42  |             vec.push(unsafe { &mut (*ptr) });
    |                               ^^^^^^^^^^^
```

And with `-Zmiri-tag-raw-pointers` on `slab` v0.4.5
```
error: Undefined Behavior: trying to reborrow <2915> for Unique permission at alloc1418[0x0], but that tag does not exist in the borrow stack for this location
   --> /tmp/slab-0.4.5/src/lib.rs:835:16
    |
835 |         match (&mut *ptr1, &mut *ptr2) {
    |                ^^^^^^^^^^
    |                |
    |                trying to reborrow <2915> for Unique permission at alloc1418[0x0], but that tag does not exist in the borrow stack for this location
    |                this error occurs as part of a reborrow at alloc1418[0x0..0x10]
    |
    = help: this indicates a potential bug in the program: it performed an invalid operation, but the 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: <2915> was created by a retag at offsets [0x0..0x10]
   --> /tmp/slab-0.4.5/src/lib.rs:833:20
    |
833 |         let ptr1 = self.entries.get_unchecked_mut(key1) as *mut Entry<T>;
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: <2915> was later invalidated at offsets [0x0..0x20]
   --> /tmp/slab-0.4.5/src/lib.rs:834:20
    |
834 |         let ptr2 = self.entries.get_unchecked_mut(key2) as *mut Entry<T>;
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

And without raw pointer tagging, `cargo miri test` on `half` v1.8.2
```
error: Undefined Behavior: trying to reborrow <untagged> for Unique permission at alloc1340[0x0], but that tag only grants SharedReadOnly permission for this location
   --> /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/slice/raw.rs:141:9
    |
141 |         &mut *ptr::slice_from_raw_parts_mut(data, len)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |         |
    |         trying to reborrow <untagged> for Unique permission at alloc1340[0x0], but that tag only grants SharedReadOnly permission for this location
    |         this error occurs as part of a reborrow at alloc1340[0x0..0x6]
    |
    = help: this indicates a potential bug in the program: it performed an invalid operation, but the 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: tag was most recently created at offsets [0x0..0x6]
   --> /tmp/half-1.8.2/src/slice.rs:309:22
    |
309 |         let length = self.len();
    |                      ^^^^^^^^^^
help: this tag was also created here at offsets [0x0..0x6]
   --> /tmp/half-1.8.2/src/slice.rs:308:23
    |
308 |         let pointer = self.as_ptr() as *mut u16;
    |                       ^^^^^^^^^^^^^
```
The second suggestion is close to guesswork, but from experience it tends to be correct (as in, it tends to locate the pointer the user wanted) more often that it doesn't.