Commit Graph

1466 Commits

Author SHA1 Message Date
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