Commit Graph

99 Commits

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