Commit Graph

2653 Commits

Author SHA1 Message Date
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 fd830e7b27 Code comment changes from code review
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-12-07 17:25:28 +00:00
5225225 250d450593 Add comment explaining false positives in _destroy 2021-12-07 17:24:29 +00:00
5225225 ae120563cc Destroying any uninit posix_ object is UB 2021-12-06 19:26:13 +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
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 70dd979a44 rustup 2021-11-30 11:44:19 -05:00
Ralf Jung d800d1e2cb rustup; stub support for some extern statics used for weak symbols 2021-11-27 17:15:54 -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
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 e6a9b2ce68 Update Miri for detecting uninitialized numbers
This commit adds a `-Zmiri-check-number-initialization` flag to check
that integers and floats are initialized.

This commit also changes some shims to write at type `MaybeUninit<...>`
in order to prevent spurious errors from the uninit check.
2021-11-10 11:36:42 -08:00
bjorn3 9944a2daf3 rustup 2021-10-26 13:42:03 +02:00
bors adc26a3062 Auto merge of #1885 - DrMeepster:global_allocator, r=RalfJung
add support for `#[global_allocator]`

This PR adds support for custom global allocators. Unfortunately, the code given in #1207 still causes errors when used with box. I believe this is because Box is special-cased in miri and stacked borrows.
2021-09-30 01:37:38 +00:00
DrMeepster e6a27a68fa implement #[global_allocator] 2021-09-28 20:32:53 -07:00
Ralf Jung 5f825ae895 rustup 2021-09-27 15:59:18 -04:00
Ralf Jung 405de0217d some more Windows argument passing tests 2021-09-24 10:33:32 -04:00
Chris Denton cfd1316e60 Apply review changes 2021-09-22 20:46:20 +01:00
Chris Denton f6cedbc744 Correct Windows argument handling
Previously the command line string would have been incorrectly constructed if argv[0] contained a doublequote (`"`) or ended in a trailing backslash (`\`). This is a very rare edge case because, by convention, argv[0] is the path to the application and Windows file names cannot contain doublequotes.

Fixes #1881
2021-09-18 18:41:55 +01:00
hyd-dev 9c62b6454e rustc_mir -> rustc_const_eval 2021-09-09 17:36:39 +08:00
bors 1cc822e6af Auto merge of #1884 - DrMeepster:start, r=RalfJung
add support for `#[start]`

This PR adds support for the `#[start]` attribute and fixes #1825.

It also renames `eval_main` to `eval_entry` to reflect that it can evaluate any entry function.
2021-09-08 19:43:41 +00:00
hyd-dev 3fedc7b249 rustc_target::abi::LayoutOf -> rustc_middle::ty::layout::LayoutOf 2021-09-06 23:05:48 +08:00
DrMeepster 1ec28f78f3 remove commented out code 2021-09-02 15:45:52 -07:00
DrMeepster 84b058ac47 add support for #[start] 2021-09-02 15:41:10 -07:00
Ralf Jung 35b64447f3 rustup 2021-08-30 10:35:34 -04:00
bors 94ae910131 Auto merge of #1875 - niluxv:volatile_set_memory_intrinsic, r=RalfJung
Add support for the `volatile_set_memory` intrinsic

Add support for the unstable `volatile_set_memory` intrinsic

(Runtime behaviour and soundness requirements for `volatile_set_memory` are identical to those of `write_bytes`, so supporting this intrinsic is trivial.)
2021-08-23 10:55:48 +00:00
Frank Steffahn c79f6dd5a0 Fix a typo “an”→“a” 2021-08-22 18:07:01 +02:00
niluxv 32c2df87be Add support for the volatile_set_memory intrinsic
Runtime behaviour and soundness requirements are identical to `write_bytes`.
2021-08-22 17:48:31 +02:00
Frank Steffahn a0d4372ff9 Fix typos “a”→“an” 2021-08-22 16:42:23 +02:00
Ralf Jung 257e9cef66 docify some comments 2021-08-02 17:58:55 +02:00
Ralf Jung 5338a16018 adjust for ERR_ON_PARTIAL_PTR_OVERWRITE 2021-08-02 17:58:55 +02:00
hyd-dev a789b49e4c Use Lrc instead of Rc in MiriCompilerCalls::config() 2021-07-30 21:28:34 +08: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 df9d481989 tell users how to disable the leak check 2021-07-25 14:21:06 +02:00
Ralf Jung 71efd950d1 also ignore 'thread leaks' with -Zmiri-ignore-leaks 2021-07-25 14:21:06 +02:00
bors eb9e3073a0 Auto merge of #1856 - RalfJung:no-mir, r=RalfJung
show proper error when using a sysroot without MIR

Fixes https://github.com/rust-lang/miri/issues/1834
2021-07-25 09:50:06 +00:00
Smit Soni 20d0f2ee26 Move shim argument checks before isolation check
This allows catching extremely incorrect arguments before rejecting
due to isolation.
2021-07-24 11:54:55 -07:00
Ralf Jung 46d31f9230 show proper error when using a sysroot without MIR 2021-07-24 14:02:09 +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
Smit Soni a1cabac727 Fix use of deprecated check_no_isolation in posix fs ops
Update posix fs shims to use new API `reject_in_isolation`, which
allows rejection with error code instead of always forcing abort.
Error code chosen for each op is the most appropriate one from the
list in corresponding syscall's manual.

Updated helper APIs to not use quotes (`) around input name while
preparing the message. This allows callers to pass multi-word string
like -- "`read` from stdin".
2021-07-20 08:23:51 -07:00
Ralf Jung 46ed39ec20 adjust for PointerOutOfBounds change 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 0341b8ac84 fmt: set force_multiline_blocks=true 2021-07-11 14:18:44 +02:00
Ralf Jung 447f23c71b fmt 2021-07-06 10:13:30 +02:00
Ralf Jung 340267525c exported_symbols_cache: ensure we do not overwrite anything 2021-07-06 10:09:53 +02:00
Ralf Jung 9b57313a4d also treat CallerLocation and Machine memory as properly tagged 2021-07-06 10:07:48 +02:00
Ralf Jung efd582c6d8 explicitly list memory kinds for stacked borrows 2021-07-06 10:04:16 +02:00