Commit Graph

6055 Commits

Author SHA1 Message Date
Ralf Jung
460a0137cc rustup 2022-05-23 12:37:48 +02:00
Ralf Jung
42d5e5bf96 move some tests to more suitable locations 2022-05-23 12:19:42 +02:00
bors
8f01d862d8 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.
2022-05-23 09:43:35 +00:00
Ralf Jung
6e7a8c017a move some compile-fail tests to a more appropriate location 2022-05-23 11:28:33 +02:00
bors
24c16b9b22 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. :)
2022-05-23 09:25:16 +00:00
Ralf Jung
4d9eafe19a fix some old typos 2022-05-23 11:24:08 +02:00
bors
27b40f124f 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
2022-05-23 08:29:51 +00:00
Ralf Jung
5ed22b32a2 test that compare-exchange-weak-failure-rate=0.0 means what it says 2022-05-23 10:28:46 +02:00
Ralf Jung
a3a2a474cb split flag section into common and advanced flags 2022-05-23 10:15:34 +02:00
bors
c51cd7a3fd 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
2022-05-23 08:07:43 +00:00
Ralf Jung
697dca2e0e clean up int2ptr code a bit 2022-05-23 10:03:33 +02:00
bors
ab03d32622 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.
2022-05-23 07:24:33 +00:00
Ralf Jung
f8f2255a91 readme: document permissive-provenance flag 2022-05-23 09:07:32 +02:00
carbotaniuman
f7bc441fd3 Initial work on permissive provenance 2022-05-23 09:07:31 +02:00
bors
72e11d370a 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 😓.
2022-05-23 07:03:49 +00:00
bors
d60aa4771b 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.
2022-05-23 06:46:46 +00:00
Thom Chiovoloni
fdfbd7a658
Fix backwards cmpxchg_weak_failure_rate check 2022-05-22 20:24:08 -07:00
Ben Kimock
b20c6cfd81 Factor current-span logic into a lazy caching handle 2022-05-22 18:23:01 -04:00
bors
62ea0c8c39 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 🙈

r? `@oli-obk`
2022-05-22 20:00:17 +00:00
Matthias Krüger
89da571b5d shims: fs: silence stderr instead of stdout.
Fixes #2143
2022-05-22 21:54:00 +02:00
Matthias Krüger
d7d7a9a162 [NFC] shims: fs: fmt 2022-05-22 21:47:44 +02:00
bors
e3227cfc7e 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.
2022-05-22 16:17:17 +00:00
Ralf Jung
73534a678d
tweak comment 2022-05-22 18:16:59 +02:00
Ben Kimock
486a769935 Handle diagnotics emitted in runtime initialization 2022-05-22 11:28:40 -04:00
bors
d58abab2e7 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 😩.

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.
2022-05-22 06:18:29 +00:00
bors
b5fc544ae8 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](5f1b033320/src/lib.rs (L206)).
- Fill out the `dwPageSize` field with the `PAGE_SIZE` constant of `4096`.

Closes #2136
2022-05-22 05:59:39 +00:00
Ralf Jung
9a5c9a5481
comment on test 2022-05-22 07:59:18 +02:00
Mateusz Gienieczko
bd731508d4
Use precomputed layouts. 2022-05-22 01:01:12 +02:00
Mateusz Gienieczko
a40ff562a0
Add i16 and u16 primitive layout. 2022-05-22 01:00:59 +02:00
Mateusz Gienieczko
b7d032c219
Fix comment formatting. 2022-05-22 00:59:49 +02:00
Mateusz Gienieczko
2fa53c0385
Dynamic offset calculation in GetSystemInfo. 2022-05-21 21:42:25 +02:00
Ben Kimock
3cfce6ffb2 Make allow_data_races_* public to silence data races during cleanup 2022-05-21 15:16:15 -04:00
Mateusz Gienieczko
63e98aee0c
Change GetSystemInfo to explicit offset. 2022-05-21 19:44:12 +02:00
Mateusz Gienieczko
c4ee368acb
Set page size in GetSystemInfo. 2022-05-21 18:17:25 +02:00
bors
38111b3916 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`
2022-05-21 16:15:49 +00:00
Mateusz Gienieczko
e932ea50ba
Add failing page_size test. 2022-05-21 16:10:08 +02:00
Ralf Jung
b4089a77ab refresh our GHA caches 2022-05-21 09:34:29 +02:00
Ralf Jung
aadbe8fd45 explain which targets we support to what extent 2022-05-20 23:41:55 +02:00
Ralf Jung
58fdd55a80 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.
2022-05-20 23:41:55 +02:00
Ralf Jung
3b73eb4456 explain what we mean by 'unsound' 2022-05-20 23:41:55 +02:00
bors
b96610b3de Auto merge of #2135 - RalfJung:rustup, r=RalfJung
rustup
2022-05-20 16:38:24 +00:00
Ralf Jung
8b4d613cc8 rustup 2022-05-20 18:37:57 +02:00
bors
d419efdba8 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
2022-05-20 06:09:13 +00:00
Ralf Jung
a941af8161 rustup 2022-05-20 08:08:11 +02:00
bors
9230b92cf2 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.
2022-05-19 15:08:22 +00:00
Ben Kimock
ada864f387 Pass the correct size to the AllocRange for log_creation 2022-05-19 09:29:08 -04:00
bors
c5f1cdb323 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
2022-05-18 06:34:48 +00:00
Ralf Jung
439f861101 rustup 2022-05-18 08:33:10 +02:00
Ralf Jung
092c2b9d92 change one of the ref-to-uninhbaited tests to Box 2022-05-18 08:32:38 +02:00
Ralf Jung
30548bb57e test for validity of references pointing to uninhabited types 2022-05-18 08:32:38 +02:00