Commit Graph

550 Commits

Author SHA1 Message Date
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
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
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
5ab0ea67f2 adjust output for calling convention check 2021-12-24 12:02:23 +01:00
Ralf Jung
44cad75069 fix iteration-order-dependent output 2021-12-15 16:51:40 +01:00
5225225
f0d915703c Add tests for double destroying various pthread items 2021-12-06 21:15:02 +00:00
5225225
eadeedde42 Handle uninit data in pthread_condattr_destroy 2021-12-05 19:47:29 +00: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
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
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
Ralf Jung
9a6a5119fc rustup 2021-08-16 17:09:21 +02: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
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
Ralf Jung
cf26458376 test for negative offsets 2021-07-20 13:30:49 +02:00
Ralf Jung
a1233a721d adjust Miri to Pointer type overhaul 2021-07-16 10:10:12 +02: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
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
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
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
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
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