Commit Graph

5947 Commits

Author SHA1 Message Date
Ralf Jung
db2c4b6dfa implement strerror_r 2022-04-16 22:54:38 -04:00
bors
d1f31f913c Auto merge of #2065 - RalfJung:readme, r=RalfJung
readme

We support SIMD these days. :D At least via portable-simd.
2022-04-16 13:17:56 +00:00
Ralf Jung
efe871f208 readme 2022-04-16 09:17:01 -04:00
bors
1ef91e1227 Auto merge of #2064 - RalfJung:rustup, r=RalfJung
rustup
2022-04-16 12:42:58 +00:00
Ralf Jung
0669b22759 rustup 2022-04-16 08:41:34 -04:00
bors
05bbfe84a9 Auto merge of #2063 - RalfJung:macos-timeout, r=RalfJung
increase slack for timeout test

This still sometimes fails on macOS, so let's increase the slack.
2022-04-10 15:24:33 +00:00
Ralf Jung
3f1d3aedcd increase slack for timeout test 2022-04-10 11:23:56 -04:00
bors
8a9ef3c248 Auto merge of #2062 - RalfJung:rustup, r=RalfJung
rustup

https://github.com/rust-lang/rust/pull/95621 made channels strict provenance compliant. :)
2022-04-10 13:37:33 +00:00
Ralf Jung
ebb70da4c6 rustup 2022-04-10 09:36:30 -04:00
bors
a4a667b3ce Auto merge of #2061 - RalfJung:edition, r=RalfJung
port Miri to edition 2021

`cargo fix --edition` didn't change anything for either of these crates, so this looks like a very simple port. And then we can remove a bunch of annoying imports. :)

I thought this also unlocks the named format string stuff, but it seems that works on all editions except for that problem around `panic!`. Whatever. ;)
2022-04-09 16:45:09 +00:00
Ralf Jung
507c09f45f use new format string syntax in some places 2022-04-09 11:32:49 -04:00
Ralf Jung
855af088b8 remove no longer needed imports 2022-04-09 11:32:49 -04:00
Ralf Jung
a57c30118a port cargo-miri to edition 2021 2022-04-09 11:17:16 -04:00
Ralf Jung
af3f683ba6 port Miri to edition 2021 2022-04-09 11:16:50 -04:00
bors
c568f32f16 Auto merge of #2060 - RalfJung:rustup, r=RalfJung
rustup

Cc https://github.com/rust-lang/rust/issues/95844
2022-04-09 13:42:12 +00:00
Ralf Jung
d2cb11cc15 rustup 2022-04-09 09:41:29 -04:00
bors
be72564a64 Auto merge of #2055 - RalfJung:rustup, r=RalfJung
Rustup

Fixes https://github.com/rust-lang/miri/issues/1717
2022-04-08 13:57:45 +00:00
Ralf Jung
3a59a15af7 rustup 2022-04-08 09:57:25 -04:00
Ralf Jung
363f8ab745 thread name setting works with strict provenance now :) 2022-04-08 09:57:25 -04:00
Ralf Jung
c8553d8162 fix Windows stdout/stderr 2022-04-08 09:57:25 -04:00
bors
f3a98563df Auto merge of #2058 - RalfJung:variadic, r=RalfJung
For variadic functions, accept arbitrary trailing arguments

However, make sure that if we use argument N we check the size of all arguments before that, because otherwise this might not work properly depending on how varargs are implemented. This caught bugs in our futex tests. ;)

I couldn't find a good way to systematically ensure this, so it is just something we have to be on the look for during review. (This generally applies also for fixed-arg shims: we should check the size of each parameter.)

Also treat prctl like a variadic function, Cc `@saethlin.`
2022-04-08 13:08:08 +00:00
Ralf Jung
cac48dd734 treat prctl like a variadic function 2022-04-07 16:20:19 -04:00
Ralf Jung
59ee672fef for variadic functions, accept arbitrary trailing arguments but make sure we check all leading arguments 2022-04-07 16:19:00 -04:00
Ralf Jung
e1556c8576 add machine hook tcx parameters 2022-04-07 15:05:47 -04:00
bors
8acc9b2799 Auto merge of #2056 - RalfJung:rustup2, r=RalfJung
rustup

Let's go in smaller steps, this might work better than https://github.com/rust-lang/miri/pull/2055
2022-04-07 12:59:13 +00:00
Ralf Jung
f2cfc928a5 rustup 2022-04-07 08:58:48 -04:00
bors
0e2def5c12 Auto merge of #2054 - m-ou-se:futex-wait-bitset, r=RalfJung
Add support for FUTEX_{WAIT,WAKE}_BITSET

FUTEX_WAIT_BITSET and FUTEX_WAKE_BITSET are extensions of FUTEX_WAIT and FUTEX_WAKE that allow tagging each waiting thread with up to 32 'labels', and then only wake up threads that match certain labels. The non-bitset operations behave like their bitset was fully set (u32::MAX), meaning that they'll wait for anything, and wake up anything.

The only other difference is that FUTEX_WAIT_BITSET uses an absolute timeout instead of an relative timeout like FUTEX_WAIT.

Often, FUTEX_WAIT_BITSET is used not for its bitset functionality, but only for its absolute timeout functionality. It is then used with a bitset of u32::MAX.

~~This adds support for only that use case to Miri, as that's all `std` currently needs. Any other bitset is still unsupported.~~

Update: This adds full support for both these syscalls.
2022-04-06 22:20:11 +00:00
Mara Bos
4fdda315cc Put 306ba8357f in rust-version. 2022-04-07 00:02:20 +02:00
Mara Bos
03417de176 Use let = if; instead of let; if. 2022-04-06 23:55:02 +02:00
Mara Bos
5581e33806 Add test for FUTEX_*_BITSET. 2022-04-06 23:48:26 +02:00
Mara Bos
53ed500c92 Fully support FUTEX_*_BITSET. 2022-04-06 23:48:14 +02:00
Mara Bos
12c88886b0 Formatting. 2022-04-06 23:13:47 +02:00
Mara Bos
a72a929b19 Add test for FUTEX_WAIT_BITSET. 2022-04-06 23:06:27 +02:00
Mara Bos
37cefa32d2 Add support for FUTEX_WAIT_BITSET(bitset=MAX). 2022-04-06 23:03:52 +02:00
bors
fb01df538e Auto merge of #2050 - RalfJung:partially-uninit, r=RalfJung
test that partially uninit MaybeUninit works correctly

This got finally fixed by https://github.com/rust-lang/rust/pull/94527 :)
2022-04-05 22:31:24 +00:00
Ralf Jung
46ff257b4e test that partially uninit MaybeUninit works correctly 2022-04-05 18:30:39 -04:00
bors
955bacc103 Auto merge of #2047 - RalfJung:no-extras, r=RalfJung
adjust for MemoryExtra being merged into Machine

The Miri side of https://github.com/rust-lang/rust/pull/95620
2022-04-05 15:14:12 +00:00
Ralf Jung
0512b2a376 rustup 2022-04-05 11:11:53 -04:00
Ralf Jung
6e1f3cd8ff adjust for MemoryExtra being merged into Machine 2022-04-05 11:11:53 -04:00
bors
95559c92b7 Auto merge of #2049 - atouchet:lic, r=RalfJung
Use SPDX license format
2022-04-05 02:29:21 +00:00
Alex Touchet
79a1001b39 Use SPDX license format 2022-04-04 15:52:09 -07:00
bors
ec51594521 Auto merge of #2046 - RalfJung:very-strict, r=RalfJung
make strict-provenance imply check-number-validity

I feel like Miri not catching [this example](https://github.com/rust-lang/unsafe-code-guidelines/issues/286#issuecomment-1085144431) with strict provenance checking enabled is surprising.

OTOH, Miri suddenly complaining about uninit data in integers with `-Zmiri-strict-provenance` also might be surprising. Which one is more surprising? I don't know. We *could* go out of our way and have a mode where uninit integers are okay but provenance is not, but I am not sure if that is truly worth it. It'd be quite annoying to implement.
2022-04-04 19:54:01 +00:00
bors
fc2165dd78 Auto merge of #2048 - RalfJung:rustup, r=RalfJung
rustup
2022-04-04 00:01:53 +00:00
Ralf Jung
830cc58f8a rustup 2022-04-03 20:00:03 -04:00
Ralf Jung
3dcba56349 add test for nasty example 2022-04-02 00:05:27 -04:00
Ralf Jung
1d79b60a1e make strict-provenance imply check-number-validity 2022-04-01 23:59:16 -04:00
bors
732461b4cd Auto merge of #2045 - RalfJung:strict-provenance, r=RalfJung
add -Zmiri-strict-provenance

This implements [strict provenance](https://github.com/rust-lang/rust/issues/95228) in Miri. The only change is that casting an integer to a pointer does not even attempt to produce a good provenance for the given address; instead, it always uses the invalid provenance. This stricter than even `-Zmiri-tag-raw-pointers` in that it also rejects the following example (which does not even involve Stacked Borrows):
```rust
fn main() {
    let x = 22;
    let ptr = &x as *const _ as *const u8;
    let roundtrip = ptr as usize as *const u8;
    let _ = unsafe { roundtrip.offset(1) };
}
```
The new flag also implies `-Zmiri-tag-raw-pointers` since the only reason one would *not* want to tag raw pointers is to support ptr-int-ptr roundtrips.

Note that the flag does *not* check against ptr-to-int *transmutes*; that still requires `-Zmiri-check-number-validity`. You can also check for strict provenance *without* Stacked Borrows by adding `-Zmiri-disable-stacked-borrows`.

The new "Miri hard mode" flags for maximal checking are `-Zmiri-strict-provenance -Zmiri-check-number-validity`. (Add `-Zmiri-symbolic-alignment-check` if you feel extra spicy today.)
2022-04-01 22:40:26 +00:00
bors
5d5d8b17cc Auto merge of #2043 - RalfJung:max-size, r=RalfJung
Rust values can be up to isize::MAX in size

Needs https://github.com/rust-lang/rust/pull/95388
2022-04-01 21:22:59 +00:00
Ralf Jung
e13668092c rustup 2022-04-01 17:22:11 -04:00
Ralf Jung
aa04dc1eeb Rust values can be up to isize::MAX in size 2022-04-01 17:22:01 -04:00