Commit Graph

4932 Commits

Author SHA1 Message Date
Ralf Jung
7b07fc385c get_or_create_thread_local_alloc_id: share code with Memory::get_global_alloc 2020-07-27 23:32:15 +02:00
Ralf Jung
0a4e8caa8c adjust to canonical_alloc_id removal 2020-07-27 23:32:15 +02:00
bors
345b033c3f Auto merge of #1487 - pnadon:miri-rename-undef-uninit, r=RalfJung
Miri rename undef uninit

The changes made here are related to [issue #71193 on Rust](https://github.com/rust-lang/rust/issues/71193), and the pull request [74664 on Rust](https://github.com/rust-lang/rust/pull/74664).

1. renamed `ScalarMaybeUninit::not_undef` to `check_init`
2. renamed `Immediate::to_scalar_or_undef` to `Immediate::to_scalar_or_uninit`
2020-07-27 21:31:51 +00:00
Philippe Nadon
6dd700fd17 Changed not_undef to check_init in foreign_items.rs
Due to changes from upstream, a commit using not_undef was inserted, which had to be updated to use check_init.

related issue #71193
2020-07-27 13:07:25 -06:00
Phil Nadon
6282e92774 Updated Rust version to latest master
Updated Rust version since the latest version contains changes which allow this version of Miri to build.
2020-07-26 16:05:56 -06:00
Philippe Nadon
21268157ff renamed Immediate::to_scalar_or_undef
to Immediate::to_scalar_or_uninit

in src/shims/intrinsics.rs

related issue #71193
2020-07-26 16:05:20 -06:00
Philippe Nadon
5161ba346c renamed ScalarMaybeUninit::not_undef to check_init
Related to PR https://github.com/rust-lang/rust/pull/74664
2020-07-26 16:05:20 -06:00
bors
91b58c93c5 Auto merge of #1485 - RalfJung:miri-extern-fn, r=oli-obk
Miri: use extern fn to expose interpreter operations to program; fix leak checker on Windows

This is the Miri side of https://github.com/rust-lang/rust/pull/74681.

Fixes https://github.com/rust-lang/miri/issues/1302
Fixes https://github.com/rust-lang/miri/issues/1318
2020-07-25 08:02:54 +00:00
Ralf Jung
c641fbde02 update rust-version 2020-07-25 10:02:25 +02:00
Ralf Jung
06f8bf6afa document Miri extern functions 2020-07-23 17:14:25 +02:00
Ralf Jung
bc0569253f enable leak check tests on Windows 2020-07-23 15:56:38 +02:00
Ralf Jung
fef5fa2ae1 add a Miri extern fn to mark an allocation as being a static root for leak checking 2020-07-23 15:47:33 +02:00
Ralf Jung
4033358956 make miri_start_panic intrinsic an FFI function 2020-07-23 15:20:36 +02:00
bors
592b140880 Auto merge of #1482 - canova:remote-unreachable, r=RalfJung
Remove unreachable intrinsic

This is now supported by the interpreter with https://github.com/rust-lang/rust/pull/74459. We can remove this intrinsic implementation here.
This is covered by this test: https://github.com/rust-lang/miri/blob/master/tests/compile-fail/unreachable.rs

I guess we need to wait until the rust-lang/rust PR merges into nightly, and then we can update `rust-version` hash in the PR, right?

r? @oli-obk
2020-07-23 09:14:08 +00:00
bors
67e7eb4b9c Auto merge of #1484 - RalfJung:rustup, r=RalfJung
rustup

Following https://github.com/rust-lang/rust/pull/69749 I added some `ty::ParamEnv::reveal_all()` even though @eddyb advised me in the past to avoid those.
2020-07-23 08:41:34 +00:00
Ralf Jung
7d6aec6887 rustup 2020-07-23 10:40:13 +02:00
bors
c44f1ae485 Auto merge of #1483 - RalfJung:fs-errno, r=RalfJung
set errno on stdout write failure
2020-07-18 15:59:19 +00:00
Ralf Jung
cded9b7142 set errno on stdout write failure 2020-07-18 17:58:21 +02:00
bors
b021209b0e Auto merge of #1436 - samrat:support-stdin-read, r=RalfJung
Handle `read`s on STDIN

Closes #1434
2020-07-18 14:56:38 +00:00
Nazım Can Altınova
d1aee6965b Remove unreachable intrinsic 2020-07-18 12:48:26 +02:00
Samrat Man Singh
f4d1841811 Remove unnecessary cast 2020-07-18 10:45:06 +05:30
Samrat Man Singh
4c1beb2e45 Ensure buffer for reading from Stdin is smaller than machine usize
Also, set appropriate error code on failure
2020-07-17 20:18:07 +05:30
bors
515287f114 Auto merge of #1480 - RalfJung:diagnostic-stacktrace-fix, r=oli-obk
fix non-fatal diagnostics stacktraces

Our non-fatal diagnostics are printed *after* completing the step that triggered them, which means the span and stacktrace used for them is that of the *next* MIR statement being executed. That's quite bad, obviously, as pointing to where in the source something happens is their entire point.

Here's an example:
```rust
use std::ptr;

static mut PTR: *mut u8 = ptr::null_mut();

fn get_ptr() -> *const u8 { unsafe { PTR }}

fn cause_ub() { unsafe {
    let _x = &*get_ptr();
} }

fn main() { unsafe {
   let mut l = 0;
   PTR = &mut l;
   let r = &mut *PTR;
   cause_ub();
   let _x = *r;
} }
```
This example is UB; if you track the pointer tag that is given in the final error, it points to the entire body of `cause_ub` as a span, instead of the `&*get_ptr();`.

I am not sure what the best way is to fix this. The cleanest way would be to capture a stack trace before the step and use it in case of a diagnostic, but that seems silly perf-wise. So instead I went with reconstructing the old stacktrace by going back one step in the MIR. This is however not possible if we were executing a `Terminator`... I think those cannot cause diagnostics but still, this is not great.

Any ideas?
r? @oli-obk
2020-07-17 11:40:40 +00:00
Ralf Jung
545aa60195 fix typo
Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-07-17 13:40:13 +02:00
Ralf Jung
d617d615e4 fix non-fatal diagnostics stacktraces 2020-07-17 12:55:45 +02:00
bors
0454dabcfb Auto merge of #1479 - RalfJung:fs-nocast, r=RalfJung
fs: remove an unnecessary intermediate cast
2020-07-16 10:17:23 +00:00
Ralf Jung
c28786d320 remove an unnecessary intermediate cast 2020-07-16 12:16:43 +02:00
bors
e5f2b1b3ef Auto merge of #1478 - RalfJung:readme, r=RalfJung
make cfg(miri) greppable
2020-07-15 08:10:02 +00:00
Ralf Jung
6dbfb2d9de make cfg(miri) greppable 2020-07-15 10:09:28 +02:00
bors
c830142e60 Auto merge of #1477 - RalfJung:rustup, r=RalfJung
rustup; fix Windows TLS
2020-07-15 06:43:14 +00:00
Ralf Jung
ce5ed69eac rustup; fix Windows TLS 2020-07-15 08:42:15 +02:00
Samrat Man Singh
74ff4f805a Read into buffer of fixed size for reads to STDIN
Also:
- Check isolation is disabled.
- Add FIXMEs to set error numbers in `read` and `write`.
2020-07-12 20:27:19 +05:30
bors
3e734ac6ef Auto merge of #1475 - RalfJung:dangcast, r=RalfJung
test casting a dangling ptr back from an int
2020-07-11 18:57:28 +00:00
Ralf Jung
f68bba9906 test casting a dangling ptr back from an int 2020-07-11 20:56:47 +02:00
bors
eee22ffdda Auto merge of #1474 - RalfJung:canonical, r=RalfJung
go back to using canonicalize()

Newer xargo should hopefully work with the paths this produces on Windows.
2020-07-11 09:08:03 +00:00
Ralf Jung
15466e00b0 go back to using canonicalize() 2020-07-11 11:07:17 +02:00
Samrat Man Singh
2602e951c0 Handle reads on STDIN 2020-07-11 14:06:49 +05:30
bors
ade99c3bed Auto merge of #1473 - Stupremee:no-ice-if-no-main-fn, r=oli-obk
Early exit if program doesn't contain a main function

Resolves #1452
2020-07-09 15:35:28 +00:00
Justus K
d23e245f38
Move no_main test to compile-fail 2020-07-09 17:21:09 +02:00
Justus K
c93fc933bd
Add ui test for early exiting if no main 2020-07-09 14:08:45 +02:00
Justus K
22e7a6263b
Early exit if program doesn't contain a main fn 2020-07-09 13:16:38 +02:00
bors
eb5ff1791b Auto merge of #1472 - RalfJung:abs, r=RalfJung
better way to get an absolute path

suggested by @matklad
2020-07-09 11:03:15 +00:00
Ralf Jung
2fbc4aa7ca
Cleanup code
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-09 13:02:42 +02:00
Ralf Jung
ee056ccf7b better way to get an absolute path 2020-07-09 12:45:35 +02:00
bors
b245786f9d Auto merge of #1471 - RalfJung:win, r=RalfJung
on Windows, strip the '\\?\' prefix from the canonical path

This should help with https://github.com/rust-lang/rust/pull/74146#issuecomment-655723028
2020-07-09 07:00:39 +00:00
Ralf Jung
7d9d74e065 on Windows, strip the '\\?\' prefix from the canonical path 2020-07-09 08:59:47 +02:00
bors
578aebf478 Auto merge of #1470 - RalfJung:machine-tracking, r=RalfJung
we cannot track all machine memory any more due to int-ptr-casts

Fixes a regression introduced by https://github.com/rust-lang/rust/pull/74006
2020-07-08 10:02:13 +00:00
Ralf Jung
dcb0f6309e we cannot track all machine memory any more due to int-ptr-casts 2020-07-08 12:01:49 +02:00
bors
5e94f57cb3 Auto merge of #1468 - RalfJung:uninit-validation, r=RalfJung
Test uninit memory validation

This adds the tests for https://github.com/rust-lang/rust/pull/74059.
2020-07-07 20:59:17 +00:00
Ralf Jung
04019eec3c rustup 2020-07-07 22:57:58 +02:00