Commit Graph

253 Commits

Author SHA1 Message Date
LeSeulArtichaut
4f2f87b2df Change ty.kind -> ty.kind() 2020-09-04 22:03:45 +02:00
David Cook
a6746ad893 Add comment 2020-09-02 20:58:41 -05:00
David Cook
7a2c6812b9 Per-thread errno storage 2020-09-02 20:57:20 -05:00
Ralf Jung
5657f08bea fs: move isolation handling to inside trait 2020-08-08 15:24:30 +02: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
Ralf Jung
7d6aec6887 rustup 2020-07-23 10:40:13 +02:00
Ralf Jung
a9dc2796ca Move get/set_at_offset helpers to global helpers file 2020-06-28 09:23:01 +02:00
Ralf Jung
e063ce2737 rustup; and a bit of UnsafeCell detection refactoring 2020-06-13 11:30:31 +02:00
Ralf Jung
379ac82a1c bump Rust, fix for renames 2020-05-09 10:15:09 +02:00
Chase Albert
4e3d1fee51 Address comments. 2020-05-04 14:24:22 -04:00
Chase Albert
78f329513a Check that shims are called with the correct number of arguments 2020-05-04 13:51:21 -04:00
Vytautas Astrauskas
5224c72403 Move the stack to the evaluator to make Miri compile with the newest Rustc. 2020-04-20 09:19:37 +02:00
Ralf Jung
6ad0187265 rustup for FieldsShape::Primitive 2020-04-17 14:19:26 +02:00
Ralf Jung
9f3383d55d rustup for import changes 2020-04-03 00:05:35 +02:00
Ralf Jung
5ce2466892 fix for FieldPlacement rename 2020-04-02 09:19:56 +02:00
Ralf Jung
f599687f3f adjust for span not being passed around any more 2020-04-02 09:14:17 +02:00
bors
6536f3165e Auto merge of #1290 - RalfJung:rustup, r=RalfJung
Rustup

Also remove ICEing `breakpoint` intrinsic shim.
2020-04-01 17:59:33 +00:00
Ralf Jung
1e3800ffb1 rustup 2020-04-01 19:40:10 +02:00
JOE1994
b3f9e53049 Implement 'GetSystemTimeAsFileTime' shim for Windows 2020-04-01 10:55:26 -04:00
Ralf Jung
8948a29a4c adjust for librustc rename; reduce 'extern crate' to rustc crates 2020-03-30 11:07:32 +02:00
Ralf Jung
5ff7eef2ff rustup; fix for TyLayout rename 2020-03-30 10:23:04 +02:00
JOE1994
fe9ecb50d1 Follow-up to reviews from RalfJung
1. Fix 'fn convert_path_separator' in src/shims/os_str.rs
2. Fix 'fn set_last_error_from_io_error' in src/helpers.rs
3. Minor comment fix for 'fn SetCurrentDirectoryW' in src/shims/env.rs
2020-03-29 11:30:08 -04:00
JOE1994
a481b8f261 partially implement 'set_last_error_from_io_error' for Windows 2020-03-29 11:30:08 -04:00
Ralf Jung
f181e75db2 rustup 2020-03-29 10:01:31 +02:00
bors
7a5e95c9ac Auto merge of #1276 - RalfJung:scalar-precise-sizes, r=RalfJung
Construct Scalar with precise sizes
2020-03-28 18:16:13 +00:00
Ralf Jung
fbbca59de7 avoid Scalar::from_(u)int in favor of giving the size explicitly 2020-03-28 17:35:40 +01:00
bors
ad14b684cc Auto merge of #1275 - JOE1994:move_string_helpers, r=RalfJung
move OsStr helpers to a separate file

Moved OsStr read/write functions from `src/helpers.rs` to `src/shims/os_str.rs`, in order to keep `src/helpers.rs` from bloating too much.
2020-03-28 15:32:16 +00:00
JOE1994
99600ba7a9 move OsStr helpers to a separate file 2020-03-28 10:43:47 -04:00
Ralf Jung
9e39bfbbd9 organize shims and make some only available to libstd as they are incomplete 2020-03-28 11:15:11 +01:00
Ralf Jung
876bded2e8 run Windows TLS dtor function 2020-03-28 10:39:29 +01:00
JOE1994
813d76d948 follow-up to reviews 2020-03-27 07:07:21 -04:00
JOE1994
fc8f88e04e change helper fn 'write_os_str_to_wide_str' 2020-03-27 00:08:27 -04:00
Ralf Jung
81d505670b rustup; get rid of some try_from that are no longer needed 2020-03-26 00:11:50 +01:00
Ralf Jung
e9e04e56fc move path methods together, to the bottom of the string helpers 2020-03-24 09:11:48 +01:00
Ralf Jung
c4e29c8646 convert dir separators on path load/store 2020-03-24 09:11:48 +01:00
Ralf Jung
4ac91384ff route all path reading/writing through central read/write methods 2020-03-24 09:11:47 +01:00
JOE1994
5f9167bdaa helper functions for env_var emulation in Windows 2020-03-23 19:40:22 -04:00
Ralf Jung
2f371774ef fix conditional compilation condition for os_str <-> bytes conversion 2020-03-23 19:43:03 +01:00
Ralf Jung
6dcca62b63 move -Zmiri-disable-isolation hint to help 2020-03-22 19:48:59 +01:00
Ralf Jung
d85f09c4e4 platform -> target 2020-03-22 08:55:39 +01:00
Ralf Jung
681819c8ad getting a path should never fail
we basically treat them as lang items
2020-03-19 08:26:08 +01:00
Ralf Jung
e6e8773272 start messages in lower-case 2020-03-19 08:25:08 +01:00
Ralf Jung
1103a10e2c adjust for error reform 2020-03-19 08:25:08 +01:00
Ralf Jung
8b6af3eacb avoid using unchecked casts or arithmetic 2020-03-17 15:21:43 +01:00
Ralf Jung
88c45f9891 adjust for rustc changes 2020-03-02 13:51:08 +01:00
Ralf Jung
cc1ebd0af6 some formatting 2020-03-01 10:29:05 +01:00
David Cook
ad8c784009 Return length from write_os_str_to_c_str 2020-02-24 19:50:25 -06:00
David Cook
94f611348f Use os_str_length_as_c_str in readdir[64]_r 2020-02-23 15:37:22 -06:00
Ralf Jung
4a9a0a9078 avoid lowercasing platforms 2020-02-23 18:54:08 +01:00
Ralf Jung
5d35548985 helpers.rs cleanup 2020-02-23 18:52:12 +01:00
Christian Poveda
208665836e
panic if target platform is incorrect instead 2020-02-22 09:02:29 -05:00
Christian Poveda
9e9a090026
minor fixes 2020-02-22 02:18:42 -05:00
Christian Poveda
8fe7543191
add helper function for target platform checks 2020-02-19 17:47:34 -05:00
Ralf Jung
ef154df607 pass MPlaceTy by-value, as we usually do 2020-01-30 13:38:49 +01:00
Ralf Jung
23c74449a2 rustup 2020-01-15 19:27:21 +01:00
Yuki Okushi
86ee705cd5 Rustup 2020-01-07 05:13:18 +09:00
Yuki Okushi
ebacb8ae4e Rustup 2020-01-05 15:55:15 -08:00
JOE1994
a4bd68a45f Add helper 'alloc_os_str_as_c_str' and use it in env_var emulation 2019-12-27 20:32:20 -05:00
Ralf Jung
cd12f47af6 make bytes conversion functions private inside read/write functions 2019-12-24 11:46:02 +01:00
Ralf Jung
2db6a3c04d use new try_from methods 2019-12-24 11:43:42 +01:00
Oliver Scherer
7ead530841 Rustfmt all the things 2019-12-23 12:56:23 +01:00
bors
a3ea1cb458 Auto merge of #1101 - christianpoveda:stat-shim, r=RalfJung
Add statx shim for linux target

This is an attempt to fix: https://github.com/rust-lang/miri/issues/999 (for linux only)

Currently there is one problem that I haven't been able to solve. `std::fs::metadata` fails because the creation time is not available even though it is provided in the shim code.

In order to inform the caller that the field was provided, the `stx_flag` field must have the bits of `STATX_BTIME` set (which they are). The creation time is in the `stx_btime` field of the `statx` struct (see [1]). The relevant code in `libstd` is here (probably?): https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/fs.rs#L322

Another important point is that we are just providing the fields that are available in "all" platforms (this is, without using any platform specific traits or so). This can be improved later.

References:
[1] Man page: http://man7.org/linux/man-pages/man2/statx.2.html
[2] libc `statx` struct: https://docs.rs/libc/0.2.63/libc/struct.statx.html

Edit: The problem is that my filesystem is not providing it and I thought all filesystems could provide it. I changed the code so it only provides those dates if they are available. now we are ready to go.

r? @RalfJung @oli-obk
2019-12-22 17:01:53 +00:00
Christian Poveda
b0c7625dd1
add statx shim for linux 2019-12-22 11:46:02 -05:00
Ralf Jung
67151a712d rustup 2019-12-08 10:32:50 +01:00
Ralf Jung
94732aaf7b rename helper methods a bit 2019-12-04 10:43:36 +01:00
Ralf Jung
01f060b6da avoid allocation in read_os_string_from_c_string 2019-12-04 10:16:08 +01:00
Aaron Hill
a418fe9826
Rustup for BodyCache changes 2019-12-02 20:21:03 -05:00
Ralf Jung
b2cddd27bd better span for functions whose frame we push 'manually' 2019-12-02 16:04:31 +01:00
Ralf Jung
b91383b068 implement proper panicking for other MIR assertions
Requires generalizing the call_function helper to arbitrary Immediate arguments
2019-12-02 16:04:31 +01:00
Ralf Jung
fe76d33506 Add and use helper function for calling a machine function and passing it some arguments 2019-11-29 09:23:29 +01:00
Ralf Jung
82374ad9bd comments and slight refactoring 2019-11-19 14:51:08 +01:00
Aaron Hill
08d3fbc76b
Support unwinding after a panic
Fixes #658

This commit adds support for unwinding after a panic. It requires a
companion rustc PR to be merged, in order for the necessary hooks to
work properly.

Currently implemented:
* Selecting between unwind/abort mode based on the rustc Session
* Properly popping off stack frames, unwinding back the caller
* Running 'unwind' blocks in Mir terminators

Not yet implemented:
* 'Abort' terminators

This PR was getting fairly large, so I decided to open it for review without
implementing 'Abort' terminator support. This could either be added on
to this PR, or merged separately.
2019-11-17 08:34:25 -05:00
Ralf Jung
d8a3a1f09c rustup for projection interning 2019-10-26 09:33:24 +02:00
Ralf Jung
c87f106cac update comments and some tweaks 2019-10-24 10:27:14 +02:00
Ralf Jung
cf9340113e rustup: more flexible write_bytes avoids allocations and removes itertools dependency 2019-10-24 10:15:30 +02:00
Christian Poveda
de12cbcb32 Fix documentation 2019-10-23 08:58:25 -05:00
Christian Poveda
fb4cb5bf4a Make size error distinguishable from other errors 2019-10-22 16:57:07 -05:00
Christian Poveda
be415dbeda Use new write_bytes method 2019-10-22 11:44:49 -05:00
Ralf Jung
2690f5948a rustup: fix for write_bytes and new union rules 2019-10-22 10:13:11 +02:00
Christian Poveda
72bd25de83 Fix merge conflicts 2019-10-21 08:49:49 -05:00
Christian Poveda
283a130dda Add docs for the new helper functions 2019-10-20 17:40:21 -05:00
Christian Poveda
9d50c5e758 Small corrections to docs 2019-10-20 07:55:26 -05:00
Christian Poveda
619ccf3834 Rename set_last_error_from_io_result 2019-10-20 07:55:25 -05:00
Christian Poveda
5c3c738c4b Make transformation to OS error explicit 2019-10-20 07:53:56 -05:00
Christian Poveda
338e51aa48 Rename consume_result 2019-10-20 07:53:55 -05:00
Christian Poveda
ed776f67ba Change last_error to a place 2019-10-20 07:42:59 -05:00
Christian Poveda
4232939319 Move last error functions to helpers 2019-10-20 07:42:59 -05:00
Christian Poveda
f7c6e0efbe Do additional bounds checks 2019-10-19 15:49:00 -05:00
Christian Poveda
ab059671cb Change comparison order for clarity 2019-10-19 14:13:49 -05:00
Ralf Jung
e574c77aa2 audit our bounds checks 2019-10-19 12:39:02 +02:00
Christian Poveda
0201cc5587 Fix writing errors 2019-10-18 15:28:06 -05:00
Christian Poveda
85941c7249 Rename write/read os string functions 2019-10-18 09:49:56 -05:00
Christian Poveda
68fec4b3fe Use conditional compilation properly and work with OsStrs instead 2019-10-18 09:49:56 -05:00
Christian Poveda
1241abbec4 Change helper functions to read/write 2019-10-18 09:49:55 -05:00
Christian Poveda
61da8b8428 Add OsString from/to bytes helper functions 2019-10-18 09:47:19 -05:00
Ralf Jung
5481afbaf6 cleanup now that borrow checker knows memory is a field 2019-10-18 11:33:12 +02:00
Yuki Okushi
a353e90eed Use memory field instead of memory() 2019-10-18 11:11:50 +09:00
Christian Poveda
78311a7132 Add function to error with enabled isolation 2019-10-15 07:33:14 -05:00
Christian Poveda
f9c768864a Use places instead of ptrs to write packed immtys 2019-10-14 16:00:40 -05:00
Christian Poveda
508df227e5 Group libc helper functions 2019-10-12 19:48:18 -05:00
Christian Poveda
2cbf4afa99 Split write_c_ints into less specific helper functions 2019-10-11 11:41:11 -05:00
Christian Poveda
b8ee90d22e Throw error instead of panicking for unfittable bits 2019-10-11 11:38:24 -05:00
Christian Poveda
9f24c12624 Add helper function to write structs 2019-10-11 11:38:22 -05:00
Christian Poveda
003b257f87 Change error handling style for consistency 2019-10-11 08:20:32 -05:00
Christian Poveda
67ea454647 Correct style of comments 2019-10-11 04:17:43 -05:00
Christian Poveda
c8df0171e8 Move functions to eval libc constants to helpers 2019-10-11 01:53:31 -05:00
Oliver Scherer
9fdb347ad7 Rustup to sty -> kind changes 2019-09-26 11:41:11 +02:00
Santiago Pastorino
5ecb2d9356
Place projection field is now Box<[PlaceElem<'tcx>]> 2019-09-15 00:05:52 -03:00
Ralf Jung
f3ff10005a small optimization 2019-08-28 18:45:10 +02:00
Ralf Jung
79dd70fd9b Stacked Borrows: don't read from memory during retagging 2019-08-28 18:41:30 +02:00
Christian Poveda
98129631b5 Use err_unsup_format instead 2019-08-20 12:20:50 -05:00
Christian Poveda
b44fd97af6 Use host's rng when communication is enabled 2019-08-19 10:43:09 -05:00
Aaron Hill
4d3398fc62
Replace match with expect() 2019-08-04 15:49:14 -04:00
Aaron Hill
c2f681f005
Add semicolon
Co-Authored-By: Ralf Jung <post@ralfj.de>
2019-08-04 10:13:29 -04:00
Aaron Hill
0505868d18
Do nothing when we try to generate random data of length 0
This preserves compatibility with programs that pass a null pointer and
a length of zero to getrandom(), or their platform's equivalent.
2019-08-04 09:21:17 -04:00
Ralf Jung
0096a0df2a gen_random helper: move ptr argument to front 2019-08-04 14:49:10 +02:00
Ralf Jung
8071034b93 fix for error refactoring 2019-08-03 10:25:55 +02:00
Ralf Jung
068517ae66 make sure we always have an RNG 2019-07-23 21:38:53 +02:00
Ralf Jung
a2541aacd6 bump rust 2019-07-21 11:56:10 +02:00
Ralf Jung
70a5bb7dbb force pointers before reborrowing; fixes cargo miri test suite 2019-07-10 14:36:56 +02:00
Ralf Jung
f79f31dfa1 adjust for rustc changes; normalize mplace before doing freeze-sensitive visit 2019-07-10 14:36:56 +02:00
Ralf Jung
3ca934f07d gen_random: use check_ptr_access 2019-07-06 10:07:22 +02:00
Ralf Jung
8093a59ffb move gen_random to helpers 2019-07-06 10:07:21 +02:00
Ralf Jung
07d5e9917c avoid Scalar::is_null_ptr, it is going away 2019-07-05 09:56:42 +02:00
Ralf Jung
c3da843ca0 we don't need zero-sized freeze-sensitive visiting 2019-07-03 10:47:28 +02:00
Ralf Jung
67d3779b0c move most of the stuff from lib.rs into machine.rs, and initialization + main loop into eval.rs 2019-06-29 13:48:59 +02:00
Ralf Jung
ad0c941547 rustup for lifetime refactorings 2019-06-13 09:18:03 +02:00
Ralf Jung
d6bcfc58e3 rustup for EvalResult rename 2019-06-08 22:14:47 +02:00
Ralf Jung
bc0c76d861 fix for latest rustc 2019-05-13 22:07:24 +02:00
Ralf Jung
be47fae173 build with latest version 2019-05-13 11:37:54 +02:00
Ralf Jung
3f0a2a2941 rewrite Stacked Borrows Core. this passes stacked-borrows.rs! 2019-04-17 16:02:57 +02:00
Oliver Scherer
9a0eaf6ebd Update to rustc nightly 2019-04-03 10:48:11 +02:00
Ralf Jung
a9b03f9411 avoid [..] 2019-02-27 11:39:59 +01:00
Alexander Regueiro
12d3ecbaff Various cosmetic improvements. 2019-02-26 18:37:46 +00:00
Ralf Jung
6b376dc394 get rid of to_bytes hack 2018-12-11 14:32:59 +01:00
Ralf Jung
9de605b32f avoid repeating signatures in EvalContext extension traits 2018-12-11 14:16:58 +01:00
Ralf Jung
68ba6cdbaa fix for new Align type 2018-11-23 09:46:51 +01:00
Ralf Jung
a1f895d6f2 retagging: descent into values, type-driven 2018-11-16 11:09:33 +01:00
Ralf Jung
020313dd85 make freezing inherently part of the high-level reactivate/initiate operations 2018-11-15 09:35:40 +01:00
Ralf Jung
f4e45ff2b7 sort the fields ourselves 2018-11-08 08:29:34 +01:00
Ralf Jung
74635a57e2 re-do large parts of stacked borrows, now with proper support for partiall frozen data 2018-11-08 08:29:34 +01:00
Ralf Jung
27b1f47b0a use crate:: where appropriate 2018-11-01 08:57:22 +01:00
Ralf Jung
957d18c343 Merge remote-tracking branch 'origin/master' into rustup 2018-10-22 08:41:01 +02:00
Ralf Jung
186e42d088 move resolve_path to helpers module 2018-10-19 09:54:41 +02:00
Ralf Jung
b84f7e2029 add Borrow tag to pointers; remove old locking code 2018-10-16 18:35:27 +02:00
Ralf Jung
904923fa7a move some more helpers to rustc 2018-08-30 10:42:18 +02:00
Ralf Jung
1a4ad2bb9f update for miri engine: new function handling, new static handling, fixed leaks 2018-08-24 16:45:08 +02:00
Ralf Jung
ea27e46a38 fix compilation after rustc change 2018-08-17 09:36:53 +02:00
Ralf Jung
259cc6e3dc rustup for big refactor; kill most of validation 2018-08-16 10:30:43 +02:00
Oliver Schneider
be91aea0fa Rustup 2018-08-07 15:22:11 +02:00