Commit Graph

969 Commits

Author SHA1 Message Date
Ralf Jung
e214e6db98 add mut_below_shr test 2022-04-20 10:52:25 -04:00
Ralf Jung
d4a85f6305 add another test for #2068 2022-04-20 10:39:17 -04:00
Ralf Jung
b5a76c7ff0 add test for https://github.com/rust-lang/miri/issues/2068 2022-04-20 08:44:10 -04:00
Ralf Jung
763ff1c49f do not consider thread-local allocations read-only 2022-04-19 14:56:07 -04:00
Ralf Jung
db2c4b6dfa implement strerror_r 2022-04-16 22:54:38 -04:00
Ralf Jung
0669b22759 rustup 2022-04-16 08:41:34 -04:00
Ralf Jung
3f1d3aedcd increase slack for timeout test 2022-04-10 11:23:56 -04:00
Ralf Jung
ebb70da4c6 rustup 2022-04-10 09:36:30 -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
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
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
Mara Bos
5581e33806 Add test for FUTEX_*_BITSET. 2022-04-06 23:48:26 +02:00
Mara Bos
a72a929b19 Add test for FUTEX_WAIT_BITSET. 2022-04-06 23:06:27 +02:00
Ralf Jung
46ff257b4e test that partially uninit MaybeUninit works correctly 2022-04-05 18:30:39 -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
Ralf Jung
aa04dc1eeb Rust values can be up to isize::MAX in size 2022-04-01 17:22:01 -04:00
Ralf Jung
9af03bf342 add -Zmiri-strict-provenance 2022-04-01 14:10:24 -04:00
Ralf Jung
811e6dd71d test int_log functions 2022-03-31 11:20:24 -04:00
Ralf Jung
5d7c495de5 channels do ptr-int transmutes so move them to non-check-number-validity test 2022-03-26 14:33:17 -04:00
Ralf Jung
951ac65f26 regression test for reverse() unsoundness 2022-03-22 14:28:36 -04:00
Ralf Jung
694846f8b4 vec test: check number validity 2022-03-22 14:26:40 -04:00
Ralf Jung
aafc0694fc test arbitrary-self dyn receivers 2022-03-20 14:03:46 -04:00
Ralf Jung
65469fe85b test remove_dir_all 2022-03-20 10:36:27 -04:00
bors
57786678d4 Auto merge of #1975 - DrMeepster:backtrace_fix, r=RalfJung
Make backtraces work with #[global_allocator]

Currently, backtraces break when the global allocator is overridden because the allocator will attempt to deallocate memory allocated directly by Miri.

~~This PR fixes that by using a new memory kind and providing a function to deallocate it. We can't call the custom allocator to allocate because it's not possible to call a function in the middle of a shim.~~

This PR fixes that by adding a new version of the backtrace API accessible by setting `flags` to 1. Existing code still functions.

backtrace-rs PR: rust-lang/backtrace-rs#462

Fixes https://github.com/rust-lang/miri/issues/1996
2022-03-20 02:37:09 +00:00
DrMeepster
2c670b10df add new version of backtrace api using flags=1 2022-03-19 18:14:11 -07:00
Ralf Jung
1b1321a685 fix simd_bitmask shorter than a byte on big-endian 2022-03-17 13:14:16 -04:00
Ralf Jung
bfed3c4f0d implement simd bitmask intrinsics 2022-03-17 13:08:01 -04:00
Ralf Jung
4fd5dca27c implement SIMD sqrt and fma 2022-03-16 22:13:43 -04:00
Ralf Jung
1f237b3b7d implement SIMD float rounding functions 2022-03-16 18:53:36 -04:00
Ralf Jung
f338b0229b test integer SIMD min/max 2022-03-14 09:53:49 -04:00
Jubilee Young
61bfa8afe8 Fixup renamed fn for Simd 2022-03-13 19:03:08 -07:00
Ralf Jung
41ffce1145 implement simd_scatter 2022-03-09 19:29:05 -05:00
Ralf Jung
576e2bbed5 implement gather 2022-03-09 19:29:05 -05:00
Ralf Jung
3eba7fcf73 implement simd_shuffle 2022-03-09 19:29:05 -05:00
Ralf Jung
6d3506adef fs: add and test for DirectoryNotEmpty error variant 2022-03-07 18:30:12 -05:00
Tavian Barnes
0886419524 Implement a readdir64() shim for Linux
Partial fix for #1966.
2022-03-07 16:19:03 -05:00
Ralf Jung
735bee2736 implement simd_saturating intrinsics 2022-03-07 14:12:59 -05:00
Ralf Jung
b87a9c90e1 fix handling of NaNs in simd max/min 2022-03-07 09:49:35 -05:00
Ralf Jung
2f97eb68a0 implement simd_fmax/fmin 2022-03-07 09:40:23 -05:00
Ralf Jung
9851b743c1 implement simd_reduce_min/max 2022-03-07 09:40:23 -05:00
Ralf Jung
db06d4998f implement simd_cast, simd_as 2022-03-07 09:40:23 -05:00
bors
a25d905ddf Auto merge of #2003 - RalfJung:simd-reduce-test, r=RalfJung
also test f32/f64 simd_reduce

Forgot to include this in https://github.com/rust-lang/miri/pull/2001
2022-03-06 04:22:12 +00:00
Ralf Jung
21d36ffd04 also test f32/f64 simd_reduce 2022-03-05 23:03:14 -05:00
Ralf Jung
9810a147a7 add extra tests for shifts with negative offsets 2022-03-05 22:59:23 -05:00
Ralf Jung
b491b72673 implement simd_reduce_{add,mul} 2022-03-05 19:02:00 -05:00
Ralf Jung
3ed8ad4423 avoid repeated string matching, and add more simd_reduce intrinsics 2022-03-05 18:46:14 -05:00
bors
3854a76ace Auto merge of #1970 - asquared31415:open_unix_varargs, r=RalfJung
Allow varargs for libc::open when it is allowed by the second argument

This PR allows `libc::open` to be called using two or three arguments as defined in https://man7.org/linux/man-pages/man2/open.2.html

The presence of the third argument depends on the value of the second argument.  If the second argument dictates that the third argument is *required* miri will emit an error if the argument is missing.  If the second argument does *not* require a third argument, then the argument is ignored and passed as 0 internally (it would be ignored by libc anyway)
2022-03-05 22:47:51 +00:00
asquared31415
8e97599af4 allow varargs for libc::open when it is allowed by the second argument 2022-03-05 17:29:48 -05:00