Commit Graph

1737 Commits

Author SHA1 Message Date
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
b5d3a25b49 detect when unused bits of a SIMD bitmask are non-0 2022-03-17 13:08:01 -04:00
Ralf Jung
bfed3c4f0d implement simd bitmask intrinsics 2022-03-17 13:08:01 -04:00
bors
670dc7d551 Auto merge of #1971 - saethlin:sb-details, r=RalfJung
Add a lot more information to SB fatal errors

In fatal errors, this clarifies the difference between a tag not being present in the borrow stack at all, and the tag being present but granting SRO. It also introduces a little notation for memory ranges so we can mention to the user that the span may point to code that operates on multiple memory locations, but we are reporting an error at a particular offset.

This also gets rid of the unqualified phrase "the borrow stack" in errors, and clarifies that it is the borrow stack _for some location_.

The crate `pdqselect` v0.1.1:
Before:
```
2103 |     unsafe { copy_nonoverlapping(src, dst, count) }
     |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no item granting read access to tag <2357> at alloc1029 found in borrow stack.
```
After:
```
2103 |     unsafe { copy_nonoverlapping(src, dst, count) }
     |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |              |
     |              attempting a read access using <2357> at alloc1029[0x0], but that tag does not exist in the borrow stack for this location
     |              this error occurs as part of an access at alloc1029[0x0..0x4]
```

And the crate `half` v1.8.2
Before:
```
131 |     unsafe { &mut *ptr::slice_from_raw_parts_mut(data, len) }
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to reborrow for Unique at alloc1051, but parent tag <2091> does not have an appropriate item in the borrow stack
```
After:
```
131 |     unsafe { &mut *ptr::slice_from_raw_parts_mut(data, len) }
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |              |
    |              trying to reborrow <2091> for Unique permission at alloc1051[0x0], but that tag only grants SharedReadOnly permission for this location
    |              this error occurs as part of a reborrow at alloc1051[0x0..0x6]
```
2022-03-17 13:26:29 +00:00
Ralf Jung
4fd5dca27c implement SIMD sqrt and fma 2022-03-16 22:13:43 -04:00
Ben Kimock
730cd27248 Print more in SB error diagnostics
This tries to clarify exactly why an access is not valid by printing
what memory range the access was over, which in combination with
tag-tracking may help a user figure out the source of the problem.
2022-03-16 20:12:04 -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
bae720c75b add ptr_offset_from OOB test, and update test errors 2022-03-10 18:56:19 -05: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
Ralf Jung
ec0e513c64 rustup 2022-03-05 17:26:32 -05:00
bors
926af6493b Auto merge of #1999 - RalfJung:forward-env, r=oli-obk
add flag to forward specific env vars (while isolation remains enabled)

The flag is called `-Zmiri-env-forward=<var>`, but I am open to bikeshedding. ;)
2022-03-05 19:36:10 +00:00
Ralf Jung
90207a5484 implement missing SIMD comparison operators, simd_xor, and simd_reduce_all 2022-03-05 13:45:13 -05:00
Ralf Jung
3adc203c1c add flag to forward specific env vars (while isolation remains enabled) 2022-03-05 11:14:37 -05:00
Ralf Jung
0d4902f12f implement simd_neg and simd_fabs 2022-03-03 14:54:54 -05:00
Ralf Jung
c0f7251055 add test for simd division overflow UB 2022-03-03 12:32:42 -05:00
Ralf Jung
97ddcf1f6b adjust for div/rem overflow being UB 2022-03-03 12:14:24 -05:00
Ralf Jung
798dc5a78a Make sure we notice when a u16 is loaded at offset 1 into a u8 allocation 2022-03-02 13:06:28 -05:00
Ralf Jung
363236e2d4 test overflowing Div/Rem 2022-03-01 18:44:37 -05:00
Ralf Jung
aa4f82ea48 implement simd_select 2022-03-01 18:40:40 -05:00
Ralf Jung
c347b04e82 add test for rust issue 94371 2022-02-27 15:27:34 -05:00
Ralf Jung
e9b140b4a5 update fn ptr tests 2022-02-25 12:06:10 -05:00
Ralf Jung
444396d620 rustup 2022-02-24 10:55:40 -05:00
Ralf Jung
1ac1e55f3b implement simd_eq and simd_reduce_any 2022-02-21 21:41:52 -05:00
Ralf Jung
6b8baee339 rustup; implement simd_and/or 2022-02-04 17:56:08 +01:00
Ralf Jung
3d5eb52cbd rustup: disable read_dir test for now 2022-02-04 17:17:28 +01:00
Miguel Ojeda
922962f662 Remove spurious maybe_uninit_extra
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-01-11 16:17:52 +01:00
bors
deb9bfd246 Auto merge of #1952 - RalfJung:self-referential, r=RalfJung
exclude mutable references to !Unpin types from uniqueness guarantees

This basically works around https://github.com/rust-lang/unsafe-code-guidelines/issues/148 by not requiring uniqueness any more for mutable references to self-referential generators. That corresponds to [the same work-around that was applied in rustc itself](b815532674/compiler/rustc_middle/src/ty/layout.rs (L2482)).

I am not entirely sure if this is a good idea since it might hide too many errors in case types are "accidentally" `!Unpin`. OTOH, our test suite still passes, and to my knowledge the vast majority of types is `Unpin`. (`place.layout.ty` is monomorphic, we should always exactly know which type this is.)
2022-01-09 14:10:00 +00:00
Ralf Jung
9376bf5d4d rustup 2022-01-08 17:27:48 +01:00
Ralf Jung
77cec811b4 exclude mutable references to !Unpin types from uniqueness guarantees 2022-01-01 19:01:46 +01:00
Ralf Jung
5ab0ea67f2 adjust output for calling convention check 2021-12-24 12:02:23 +01:00
Ralf Jung
d8f7b831e7 add regression test 2021-12-15 19:11:08 +01:00
Ralf Jung
44cad75069 fix iteration-order-dependent output 2021-12-15 16:51:40 +01:00
bors
dadcbebfbd Auto merge of #1934 - RalfJung:rustup, r=RalfJung
rustup

Cc https://github.com/rust-lang/rust/issues/91649
2021-12-08 15:19:55 +00:00
Ralf Jung
50b9b701ab rustup 2021-12-08 10:01:51 -05:00
bors
23a9d02748 Auto merge of #1933 - 5225225:1931-condvar-false-positive, r=RalfJung
Fix false positive use of uninit bytes when calling `libc::pthread_condattr_destroy`

Fixes: #1931
2021-12-08 14:51:53 +00:00
5225225
a4b2fc0c5a Adjust pthread tests 2021-12-06 21:50:14 +00:00
5225225
f0d915703c Add tests for double destroying various pthread items 2021-12-06 21:15:02 +00:00
bors
81e59e6b92 Auto merge of #1930 - tavianator:avoid-adjacent-allocations, r=RalfJung
intptrcast: Never allocate two objects directly adjecent

When two objects directly follow each other in memory, what is the
provenance of an integer cast to a pointer that points directly between
them?  For a zero-size region, it could point into the end of the first
object, or the start of the second.

We can avoid answering this difficult question by simply never
allocating two objects directly beside each other.  This fixes some of
the false positives from #1866.
2021-12-06 01:33:55 +00:00
Ralf Jung
6a98c64c8b
final tweaks 2021-12-05 20:33:20 -05:00
5225225
eadeedde42 Handle uninit data in pthread_condattr_destroy 2021-12-05 19:47:29 +00:00
Ralf Jung
d537ed401d rustup 2021-12-05 11:02:20 -05:00
Tavian Barnes
b0a463334c intptrcast: Never allocate two objects directly adjecent
When two objects directly follow each other in memory, what is the
provenance of an integer cast to a pointer that points directly between
them?  For a zero-size region, it could point into the end of the first
object, or the start of the second.

We can avoid answering this difficult question by simply never
allocating two objects directly beside each other.  This fixes some of
the false positives from #1866.
2021-12-03 17:00:06 -05:00
Ralf Jung
ee666d8987 add tests for alignment on array initialization 2021-11-28 10:07:31 -05:00
Ralf Jung
4414d96323 implement shl and shr SIMD intrinsics 2021-11-25 17:26:37 -05:00
Ralf Jung
a534bbbf8a portable SIMD: add rem intrinsic; test div and rem intrinsic UB 2021-11-25 17:13:33 -05:00
bors
4f0faed6d2 Auto merge of #1922 - RalfJung:async-run-fut, r=RalfJung
async-fn test: make run_fut more general and entirely safe
2021-11-23 19:44:55 +00:00
Ralf Jung
c4502cbbe8 async-fn test: make run_fut more general and entirely safe 2021-11-23 14:33:00 -05:00
Ralf Jung
7dd1f0571c test for overflow-checks=off 2021-11-23 14:07:46 -05:00
Ralf Jung
b816cb94e7 implement SIMD sub, mul, div; also test i32 binops 2021-11-20 22:30:49 -05:00
Ralf Jung
0766da6fbe implement simd_add 2021-11-20 22:30:49 -05:00
Ralf Jung
d8bee92aee rename track-raw-pointers flag to tag-raw-pointers 2021-11-13 15:48:27 -05:00
Noah Lev
1cca2acf95 Add test for uninit raw ptrs 2021-11-10 11:36:42 -08:00
Noah Lev
b3be6b44b6 Add tests for -Zmiri-check-number-validity 2021-11-10 11:36:42 -08:00
Noah Lev
6d1d8c69a0 rustup 2021-11-01 16:12:38 -07:00
Ralf Jung
a6b12c229b rustup; add swap_remove test 2021-10-21 09:49:19 -04:00
Ralf Jung
f040413af8 rustup 2021-10-12 11:39:06 -04:00
Noah Lev
e751c7b04e rustup 2021-10-07 11:52:11 -07:00
Noah Lev
9af75a824f rustup
Update to the `HEAD` commit of rust-lang/rust and fix test failure.
2021-10-05 13:13:06 -07:00
DrMeepster
e6a27a68fa implement #[global_allocator] 2021-09-28 20:32:53 -07:00
hyd-dev
9a877b80fe
Add #[allow(dead_code)] in some tests 2021-09-11 18:58:57 +08:00
DrMeepster
84b058ac47 add support for #[start] 2021-09-02 15:41:10 -07:00
hyd-dev
7301fe118a
Move #[allow(unreachable_code)] in tests/run-pass/generator.rs 2021-08-26 16:16:43 +08:00
hyd-dev
33a67c6b33
Add #[allow(unreachable_code)] to drop(x) in tests/run-pass/generator.rs 2021-08-24 18:50:41 +08:00
niluxv
083e5e604c Add test for volatile_set_memory 2021-08-23 12:42:13 +02:00
Ralf Jung
9a6a5119fc rustup 2021-08-16 17:09:21 +02:00
hyd-dev
838ed1d754
Update tests for #[no_mangle] associated functions 2021-08-15 17:21:33 +08:00
Ralf Jung
78b4c7bf79 rustup 2021-08-14 14:47:57 +02:00
hyd-dev
af7eb369b1
Fix tests for C-unwind ABI changes 2021-08-07 15:57:54 +08:00
Ralf Jung
5338a16018 adjust for ERR_ON_PARTIAL_PTR_OVERWRITE 2021-08-02 17:58:55 +02:00
bors
02f78b089c Auto merge of #1858 - RalfJung:thread-leaks, r=oli-obk
also ignore 'thread leaks' with -Zmiri-ignore-leaks

This is a step towards https://github.com/rust-lang/miri/issues/1371. The remaining hard part would be supporting checking for memory leaks when there are threads still running. For now we elegantly avoid this problem by using the same flag to control both of these checks. :)
2021-07-27 12:23:56 +00:00
Ralf Jung
78bcd12b17 make sure we only terminate main thread once TLS is initialized 2021-07-27 14:05:37 +02:00
Ralf Jung
66aa3d0247 make the loop infinite 2021-07-27 13:58:55 +02:00
Ralf Jung
679d10f98b no concurrency on windows 2021-07-25 14:38:02 +02:00
bors
e445f78951 Auto merge of #1859 - RalfJung:global-system-mixup, r=RalfJung
add test for mixing up System and Global memory
2021-07-25 12:37:03 +00:00
Ralf Jung
24fa9deddc add test for mixing up System and Global memory 2021-07-25 14:36:00 +02:00
Ralf Jung
71efd950d1 also ignore 'thread leaks' with -Zmiri-ignore-leaks 2021-07-25 14:21:06 +02:00
Smit Soni
da6880427a Update error code for fs ops in isolation
Change the code to either `EACCES` (if the op is performed on the
path), or `EBADF` (if the op is performed the fd)

Updated ops: `stat`, `opendir`, `ftruncate64`, and `readlink`

Add a new test for fs ops in isolation.
2021-07-20 08:23:51 -07:00
Ralf Jung
cf26458376 test for negative offsets 2021-07-20 13:30:49 +02:00
Ralf Jung
6ce77164c1 rustup 2021-07-20 12:18:59 +02:00
Ralf Jung
bf8b2aa8dc add test for better ptr handling in enum niches 2021-07-17 13:59:58 +02:00
Ralf Jung
a1233a721d adjust Miri to Pointer type overhaul 2021-07-16 10:10:12 +02:00
Aaron Hill
811423e761
Rustup for #[track_caller] trait object changes
Change test to assert that we get the correct location
even through a trait object call.
2021-07-10 11:51:00 -05:00
Ralf Jung
833dff994f rustup 2021-07-07 09:33:01 +02:00
hyd-dev
2644647053
Update backtraces 2021-06-20 15:12:11 +08:00
Ralf Jung
7f3dd37f1e rustup 2021-06-17 20:52:35 +02:00
bors
486b5dfe74 Auto merge of #1832 - hyd-dev:1776-follow-up, r=RalfJung
Report an error if a `#[no_mangle]`/`#[export_name = ...]` function has the same symbol name as a built-in shim

Implements https://github.com/rust-lang/miri/pull/1776#issuecomment-821322605.

The error looks like this:
```
error: found `malloc` symbol definition that clashes with a built-in shim
  --> tests/compile-fail/function_calls/exported_symbol_shim_clashing.rs:12:9
   |
12 |         malloc(0);
   |         ^^^^^^^^^ found `malloc` symbol definition that clashes with a built-in shim
   |
help: the `malloc` symbol is defined here

  --> tests/compile-fail/function_calls/exported_symbol_shim_clashing.rs:2:1
   |
2  | / extern "C" fn malloc(_: usize) -> *mut std::ffi::c_void {
3  | |     //~^ HELP the `malloc` symbol is defined here
4  | |     unreachable!()
5  | | }
   | |_^
   = note: inside `main` at tests/compile-fail/function_calls/exported_symbol_shim_clashing.rs:12:9
```

This does not implement "better error messages than we do currently for arg/ABI mismatches" in https://github.com/rust-lang/miri/pull/1776#issuecomment-821343175 -- I failed to remove all `check_arg_count()` and `check_abi()` (they are still used in `src/shims/intrinsics.rs` and `call_dlsym()`) and they don't receive the name of the shim.
2021-06-15 09:53:05 +00:00
hyd-dev
dfd7a6d5aa
Rustup 2021-06-15 16:12:47 +08:00
hyd-dev
e46aab5816
Use check_shim() for abort 2021-06-11 15:47:12 +08:00
hyd-dev
c822ec59aa
Implement cache for not found symbols 2021-06-11 15:24:51 +08:00
hyd-dev
ce7040075a
Disallow #[no_mangle]/#[export_name = ...] functions that have the same symbol name as built-in shims 2021-06-11 15:18:47 +08:00
hyd-dev
6aef1d687d
Remove erroneous exit() and ExitProcess() in tests/run-pass/function_calls/exported_symbol.rs 2021-06-11 13:32:00 +08:00
hyd-dev
4f3718ef85
Fix the wrong EmulateByNameResult::NotSupported in syscall shim 2021-06-11 11:44:57 +08:00
bors
e5c3af6f51 Auto merge of #1818 - landaire:feature/panic-on-unsupported-syscalls, r=RalfJung
Add support for panicking in the emulated application when unsupported functionality is encountered

This PR fixes #1807 and allows an optional flag to be specified to panic when an unsupported syscall is encountered. In essence, instead of bubbling up an error in the context of the Miri application Miri will panic within the context of the *emulated* application. This feature is desired to allow CI pipelines to determine if a Miri failure is unsupported functionality or actual UB. Please read [this comment](https://github.com/rust-lang/miri/issues/1807#issuecomment-845425076) for the rationale behind this change.

Note: this change does not cover all cases where unsupported functionality errors may be raised. If you search the repo for `throw_unsup_format!` there are many cases that I think are less likely to occur and may still be problematic for some folks.

TODO:

- [x] README documentation on this new flag
- [x] Add tests
2021-06-09 18:09:06 +00:00
Ralf Jung
a38f02c44c isolated operations return EPERM; tweak isolation hint 2021-06-09 18:24:59 +02:00
Smit Soni
892f706ce5 Add a support to execute isolated op without halting
In user interface, added a new flag `-Zmiri-isolation-error` which
takes one of the four values -- hide, warn, warn-nobacktrace, and
abort. This option can be used to configure Miri to either abort or
return an error code upon executing isolated op. If not aborted, Miri
prints a warning, whose verbosity can be configured using this flag.

In implementation, added a new enum `IsolatedOp` to capture all the
settings related to ops requiring communication with the
host. Old `communicate` flag in both miri configs and machine
stats is replaced with a new helper function `communicate()` which
checks `isolated_op` internally.

Added a new helper function `reject_in_isolation` which can be called
by shims to reject ops according to the reject_with settings. Use miri
specific diagnostics function `report_msg` to print backtrace in the
warning. Update it to take an enum value instead of a bool, indicating
the level of diagnostics.

Updated shims related to current dir to use the new APIs. Added a new
test for current dir ops in isolation without halting machine.
2021-06-09 05:50:52 -07:00
hyd-dev
23c0495ebd
Update Box<Any> to Box<dyn Any> in catch_panic.stderr 2021-06-08 22:18:27 +08:00
Lander Brandt
ae237098f8 Add support for panicking in the emulated application when unsupported syscalls are encountered 2021-06-07 15:21:53 -07:00
Ralf Jung
0ece55d748
expand comment 2021-06-06 10:33:46 +02:00
hyd-dev
d7aff96053
Remove 2 tests 2021-06-06 11:22:25 +08:00
hyd-dev
879000b133
Detect std by checking if the crate defines #[lang = "start"] rather than string comparison 2021-06-06 11:12:05 +08:00
bors
28717a0e90 Auto merge of #1776 - hyd-dev:1170, r=RalfJung
Implement calls to exported symbols (#1170)

Closes #1170.
2021-06-03 15:59:56 +00:00
Pointerbender
386863ac53 added a strings.rs regression test case for potential future UB 2021-06-03 17:25:23 +02:00
hyd-dev
ba3b11fa42
Remove some tests 2021-06-03 14:16:58 +08:00
hyd-dev
e4e6c25f67
Remove FIXME in tests/compile-fail/panic/bad_unwind.rs 2021-06-03 13:39:33 +08:00
Pointerbender
c6dbe5cdca use references so that potential aliasing bugs are triggered during regression test 2021-06-02 15:36:18 +02:00
Pointerbender
b8aba11de3 regression tests for pointer invalidation in core library slice methods 2021-06-02 15:36:18 +02:00
Aaron Hill
73700bc01c
Rustup for const_err changes 2021-05-31 10:50:25 -05:00
hyd-dev
a952787163
Improve tests 2021-05-31 11:57:16 +08:00
hyd-dev
45832d4031
Remove duplicated "foreign function" 2021-05-31 11:57:15 +08:00
hyd-dev
41f33a64f8
Implement calls to exported symbols 2021-05-31 11:15:29 +08:00
hyd-dev
71f4140550
Add -Zmiri-disable-abi-check 2021-05-31 11:14:23 +08:00
hyd-dev
9b2d42587f
unwind is no longer Option<BasicBlock> 2021-05-28 22:08:51 +08:00
Ralf Jung
393ce98b32 fix a Stacked Borrows test whose output changed 2021-05-23 18:04:13 +02:00
Ralf Jung
dd404cc92e avoid importing C functions in alloc_write_race test 2021-05-19 15:27:58 +02:00
Ralf Jung
801a1744cd update for Memory API changes 2021-05-19 15:27:58 +02:00
Ralf Jung
7af7e9e4f3 rustup 2021-05-11 15:32:05 +02:00
hyd-dev
1ab9fd50a4
Update pointer error messages 2021-05-08 15:33:27 +08:00
Ralf Jung
a2b227f95a stacked borrows: ensure array-to-elem casts behave correctly 2021-05-07 09:24:33 +02:00
hyd-dev
47c5b6eb08
encountered a NULL reference -> encountered a null reference 2021-05-04 15:53:19 +08:00
Smitty
e0e59f6020 Simplify finiteness checking 2021-05-03 10:08:42 -04:00
Smitty
68d29554a8 test for infinite value in f*_fast 2021-05-03 09:56:51 -04:00
Smitty
e591b83185 UB if f*_fast intrinsic called with nonfinite value 2021-05-02 12:25:00 -04:00
hyd-dev
2da6bedaec
Use harness = false instead of #![feature(custom_test_frameworks)] 2021-05-01 22:28:33 +08:00
hyd-dev
b30c5fef5b
Rustup for rust-lang/rust#84401 2021-04-30 19:35:59 +08:00
Ralf Jung
4c741e5fb2 rustup 2021-04-25 16:57:48 +02:00
Ralf Jung
2ae699c56d make TLS-drop-test more cross-platform 2021-04-20 09:59:26 +02:00
Ralf Jung
d512ba2ae2 test thread_local_const_init 2021-04-18 11:01:08 +02:00
Charles Lew
85f7dd6131 Remove main_fn.rs test. 2021-04-17 00:04:09 +08:00
Aliénore Bouttefeux
648638976a allow deref of null ptr in test 2021-04-15 10:00:39 +02:00
Ralf Jung
0674d439b6 test calling pthread_cond_timedwait with an already elapsed timeout 2021-04-11 14:21:42 +02:00
Ralf Jung
21968aa53b add test to detect dropped temporary 2021-04-10 12:09:10 +02:00
hyd-dev
3dff1d4fcd
Don't use MIRI_DEFAULT_ARGS to compile host crates 2021-04-09 00:57:59 +08:00
Ralf Jung
31bd77c7d8 bump miri dependencies 2021-04-04 11:48:20 +02:00
Ralf Jung
de0f3f930b rustup 2021-03-28 01:36:41 +01:00
Ralf Jung
585e51aabd disable MIR opts for ZST-related tests 2021-03-25 12:44:30 +01:00
Ralf Jung
b4b048cc86 rustup; better comment in storage_dead_dangling test 2021-03-22 12:35:30 +01:00
hyd-dev
633ac2a222
Remove meaningless tests 2021-03-17 21:55:45 +08:00
hyd-dev
bbc348539b
Unsupported foreign non-"C"/"system"-ABI function calls are not UB 2021-03-17 21:20:04 +08:00
bors
0788188c7b Auto merge of #1743 - RalfJung:callee-checks, r=RalfJung
Check callee ABI when Miri calls closures

Fixes https://github.com/rust-lang/miri/issues/1741
2021-03-14 18:05:18 +00:00
Ralf Jung
15465a5881 don't ICE when we unwind despite panic=abort 2021-03-14 17:10:45 +01:00
Ralf Jung
c9ff02f549 ensure we catch incorrectly unwinding calls 2021-03-14 17:03:20 +01:00
Ralf Jung
d1dec9cd23 don't ICE when callee has the wrong number of arguments 2021-03-14 15:38:22 +01:00
Ralf Jung
893843fd45 when Miri calls a function ptr, make sure it has the right ABI 2021-03-14 15:30:37 +01:00
Ralf Jung
98f28ac9c8 rustup 2021-03-11 09:07:05 +01:00
Ralf Jung
7a7f7b1a7a rustup 2021-03-10 15:21:12 +01:00
Mara Bos
90e218ad90 Fix panic test. 2021-03-08 17:06:50 +01:00
Mara Bos
5bd5ea21ea Remove unwrap_none as it won't be stabilized.
This upgrades to the latest rustc to be able to use try_insert()
instead.
2021-03-08 16:59:20 +01:00
Smitty
26e97ec54f Support breakpoint intrinsic 2021-03-04 07:48:28 -05:00
bors
2670839e1a Auto merge of #1721 - henryboisdequin:add-atomic-min-and-max, r=oli-obk
Add atomic min and max

Closes #1718
Previous attempt: #1653

TODO:

- [x] Merge `atomic_op` and `atomic_min_max` functions
- [x] Fix CI

**Note:** this PR also removes arbitrary trailing whitespace and generally formats the affected files
2021-03-02 14:52:32 +00:00
Henry Boisdequin
f8440d6c99 Add in atomic_{min,max}_x intrinsics
Co-authored-by: Greg Bowyer <gbowyer@fastmail.co.uk>
2021-03-02 20:17:05 +05:30
Ralf Jung
97e45e0699 make optimized-test-run a bit more like what cargo does 2021-03-02 11:04:35 +01:00
Ralf Jung
7acf80d2bb rustup; fix tests for new MIR optimization 2021-03-02 10:57:08 +01:00
Ralf Jung
48f7c8e2e6 fix reborrowing of tagged ZST references 2021-02-27 20:10:50 +01:00
Ralf Jung
c003fd0157 rustup 2021-02-23 09:23:49 +01:00
Ralf Jung
a5a751e795 rustup 2021-02-17 09:37:21 +01:00
Ralf Jung
4c867feeb6 add test by @eddyb 2021-02-16 10:18:31 +01:00
Ralf Jung
0b3dba8e70 rustup and temporarily disable broken tests 2021-02-16 09:55:33 +01:00
Caleb Zulawski
dd81fb3f10 Remove non-power-of-two SIMD vectors 2021-02-08 00:17:24 -05:00
Mara Bos
7fc24442bd Update rust version.
- Allow new non_fmt_panic lint in test.
- Remove stabilized feature(wake_trait).
2021-02-05 10:08:05 +01:00
Ralf Jung
d309804395 rustup 2021-02-03 23:37:40 +01:00
Ralf Jung
6f5a91f70a rustup 2021-01-31 13:12:25 +01:00
Ralf Jung
9d777d8410 add test for caller ABI check 2021-01-29 21:16:17 +01:00
bors
a0485c5a90 Auto merge of #1686 - thomcc:cmpxchg_weak, r=oli-obk
Add random failures to compare_exchange_weak

In practice this is pretty useful for detecting bugs.

This fails more frequently than realistic (~~50%~~ (now 80%, controlled by a flag) of the time). I couldn't find any existing code that tries to model this (tsan, cdschecker, etc all seem to have TODOs there). Relacy models it with a 25% or 50% failure chance depending on some settings.

CC `@JCTyblaidd` who wrote the code this modifies initially, and seems interested in this subject.
2021-01-28 09:52:04 +00:00
Ralf Jung
e308eeb3f1 rustup; more slack for timing tests 2021-01-27 10:44:08 +01:00
Ralf Jung
0e56bff5f9 erroneous_const span now changes with inlining 2021-01-26 11:48:11 +01:00
Ralf Jung
d38e861f1e rustup; allow some lints 2021-01-26 11:43:39 +01:00
Thom Chiovoloni
d4b592ed17 Fail 80% of the time on weak cmpxchg, not 50% 2021-01-26 00:13:54 -08:00
Thom Chiovoloni
efd2d55e00 review nits 2021-01-26 00:13:54 -08:00
Thom Chiovoloni
b6eccc6482 Test that _weak atomics sometimes fail 2021-01-26 00:13:54 -08:00
Thom Chiovoloni
c678bd722e Add random failures to compare_exchange_weak 2021-01-26 00:13:54 -08:00
Ralf Jung
3990debf82 rustup; test swap of element with itself 2021-01-22 09:22:53 +01:00
Ralf Jung
7125b86c33 remove some unnecessary feature gates 2021-01-16 18:27:10 +01:00
Ralf Jung
4a035103dc rustup; make tests pass again 2021-01-15 16:41:14 +01:00
Ralf Jung
82c6c77b9a test Weak into_raw/from_raw on dangling ptrs 2020-12-31 13:11:34 +01:00
Ralf Jung
7e198147df panicing now works with -Zmiri-track-raw-pointers 2020-12-31 00:17:08 +01:00
Ralf Jung
a81ebd8fe3 rustup; add an interesting alias test case 2020-12-29 19:27:45 +01:00
Ralf Jung
3d151c8b62 leak checker: also test AtomicPtr stored via 'swap' 2020-12-21 11:36:39 +01:00
JCTyBlaidd
aaf8ca4c77 Fix review changes 2020-12-13 11:04:58 +00:00
JCTyBlaidd
4e74f9f013 Change to disable mir-opt in compile-flags 2020-12-13 11:04:58 +00:00
JCTyBlaidd
3df67141e6 Disable tests in windows 2020-12-13 11:04:58 +00:00
JCTyBlaidd
a30105df0b Defeat the mir-opt=3 optimizer. 2020-12-13 11:04:58 +00:00
JCTyBlaidd
8676c60f87 Update note 2020-12-13 11:04:58 +00:00
JCTyBlaidd
296ba8b1c8 Fix bug with reporting wrong thread for races with reads & add thread ids to data-race tests 2020-12-13 11:04:58 +00:00
JCTyBlaidd
fbe7fbb890 Add concurrent caller location test 2020-12-13 11:04:58 +00:00
JCTyblaidd
c4ccd0b6a1 Fix nits
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-12-13 11:04:58 +00:00
JCTyBlaidd
f4bcef1113 Increase sleep times for the scheduler 2020-12-13 11:04:58 +00:00
JCTyBlaidd
c45b1b16be More tests, fix issue 1643 and detect races with allocation. 2020-12-13 11:04:58 +00:00
Ralf Jung
27a518e166 enable track-raw-ptr tests on Windows 2020-12-11 11:28:33 +01:00
Ralf Jung
7bbd6bca77 rustup 2020-12-10 19:53:45 +01:00
Ralf Jung
2f0d7d38b4 rustup; test AtomicPtr leak checker 2020-12-10 00:09:52 +01:00
bors
a2fa80d277 Auto merge of #1641 - JCTyblaidd:update_release_sequences, r=RalfJung
Weaken release sequences to match the C++20 memory model

See [Weaken Release Sequences](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0982r1.html), since the exception for relaxed writes on the same thread as a release write not blocking release sequences was removed in the C++20 memory model compared to the C11 memory model the paper was based on. The implementation can be updated and simplified to match this.  [Rust is currently specified to use the C++20 memory model](https://doc.rust-lang.org/std/sync/atomic/index.html).
2020-12-06 19:12:16 +00:00
JCTyBlaidd
a6f377e48e Fix typo 2020-12-06 17:11:24 +00:00
JCTyBlaidd
4cf614ef33 Update release sequence handling to C++20 semantics. 2020-12-06 16:58:32 +00:00
Mara Bos
de5b26d7f0 Use new std::alloc::Allocator interface.
This was changed in core.
2020-12-05 00:13:33 +01:00
bors
d473242ecd Auto merge of #1617 - JCTyblaidd:data_race_detector, r=RalfJung
Add simple data-race detector

Partially fixes data-race detection, see #1372, based on Dynamic Race Detection for C++11

- This does not explore weak memory behaviour, only exploring one sequentially consistent ordering.
- Data-race detection is only enabled after the first thread is created, so should have minimal overhead for non-concurrent execution.
- ~~Does not attempt to re-use thread id's so creating and joining threads lots of time in an execution will result in the vector clocks growing in size and slowing down program execution~~ It does now
2020-11-29 18:44:28 +00:00
JCTyBlaidd
55fc552d99 Apply review changes, incrementing the clocks twice is an unnecessary hold-over from earlier versions so fixed. 2020-11-27 19:26:06 +00:00
JCTyBlaidd
3268f56a97 Fix review changes 2020-11-22 17:28:12 +00:00
Ralf Jung
7a2c2f8dde rustup; test sorting for provenance-correctness 2020-11-22 18:08:57 +01:00
est31
4de113acba Normalize column numbers 2020-11-19 09:21:11 +01:00
JCTyBlaidd
a3b7839bbd Add comment regarding seq-cst ordering & add test for disabling the data-race detector. 2020-11-15 20:12:58 +00:00
JCTyBlaidd
69fb6413dd Tidy up comments and function layout, should fix most of the review notes. 2020-11-15 18:30:26 +00:00
Ralf Jung
915d091973 rustup; less strict timing tests 2020-11-12 16:50:24 +01:00
Ralf Jung
df0de77fd1 test btreemap with raw ptr tracking 2020-11-10 16:51:55 +01:00
Ralf Jung
db718d72ae remove some unnecessary feature flags 2020-11-10 16:51:07 +01:00
Ralf Jung
737ecef376 rustup and update test 2020-11-10 16:47:56 +01:00
JCTyBlaidd
2a40d9b7a0 More aggressive vector index re-use, and added some tests. 2020-11-06 17:29:54 +00:00
Ralf Jung
f31f00d5af rustup 2020-11-05 17:09:44 +01:00
JCTyBlaidd
95c99b2044 Detect races between atomic and non-atomic accesses of a variable,
previously only data races between two non-atomic accesses were
 detected.
2020-11-04 21:35:48 +00:00
JCTyBlaidd
fe2e857cc3 Add newlines at end of file + use replace.
add dangling thread variant of one of the benchmarks
2020-11-02 13:08:09 +00:00
JCTyBlaidd
2e75de5ac9 Mark all new tests as disabled on windows 2020-11-02 12:40:12 +00:00
JCTyBlaidd
ed32b260f9 Add tests, and fix bug in atomic RMW relaxed stores 2020-11-02 02:57:06 +00:00
Ralf Jung
00bc944eea test Rc with raw pointer tracking 2020-10-31 16:24:34 +01:00
Ralf Jung
f936bc6b92 fix writing to read-only raw pointer in thread-local test 2020-10-31 16:24:34 +01:00
Ralf Jung
80a0a12b07 Stacked Borrows: test raw-ref-to-field with raw ptr tracking 2020-10-31 16:24:34 +01:00
Ralf Jung
e7246be4f0 backtrace tests: support more ways of checking out Rust locally 2020-10-31 13:47:42 +01:00
Ralf Jung
2a4faf638b increase timeout to avoid spurious test failures 2020-10-30 18:59:58 +01:00
Ralf Jung
1ad827c511 rustup 2020-10-29 20:57:38 +01:00
bors
83f7657ed0 Auto merge of #1603 - RalfJung:track-raw, r=oli-obk
add an option to track raw pointer tags in Stacked Borrows

Also make error messages more informative by printing the affected memory location
2020-10-28 13:19:25 +00:00
Ralf Jung
bf54607ba0 test raw pointer tracking; we cannot track raw pointers on Windows 2020-10-28 13:54:50 +01:00
Ralf Jung
1044099c19 disable debug assertions in the standard library 2020-10-28 12:43:11 +01:00
Ralf Jung
19e78a65d9 run some tests with raw pointer tracking 2020-10-28 12:35:05 +01:00
Ralf Jung
ecf330f39e test Box::into_raw aliasing 2020-10-27 17:26:36 +01:00
Ralf Jung
ddcc4f241e rustup; make panic output less dependent on stdlib internals 2020-10-25 10:00:50 +01:00
Ralf Jung
80c4b5d674 fix './miri test' 2020-10-22 10:36:05 +02:00
Ralf Jung
ad07b2bd44 rustup; increase slack for timing tests 2020-10-22 09:47:02 +02:00
Aaron Hill
05bb560de2
Enable backtrace feature in the generated Xargo.toml
This allows the normal std panic hook to print a backtrace if
`RUST_BACKTRACE=1` and `-Z miri-disable-isolation` are set
2020-10-20 18:27:55 -04:00