Commit Graph

1877 Commits

Author SHA1 Message Date
bors 39146c44bd Auto merge of #1130 - christianpoveda:ignore-close-read-only, r=RalfJung
Ignore close errors in read-only files.

this fixes https://github.com/rust-lang/miri/issues/999

r? @RalfJung
2019-12-31 11:00:08 +00:00
Christian Poveda a40a99d849 avoid double negation 2019-12-30 17:26:17 -05:00
bors 9f79aa9bb4 Auto merge of #1131 - JOE1994:alloc_os_str_as_c_str, r=RalfJung
Add helper 'alloc_os_str_as_c_str' and use it in env_var emulation

First part of the plan laid out in #707 (comment).

Re-submitting a pull-request for work from  #1098 (manual rebasing..)

r? @RalfJung
2019-12-30 19:15:53 +00:00
Christian Poveda ce4e1f9fe7 add comments 2019-12-29 22:51:48 -05:00
Christian Poveda b7e6135d7b Use Scalar::to_u16 2019-12-28 08:38:31 -05: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
Christian Poveda f00fd3990b avoid excluding TERM env var 2019-12-27 08:37:52 -05:00
Christian Poveda dc4b8ac2e6 close file silently if the file is read only 2019-12-27 08:34:35 -05:00
Oliver Scherer 4aef81eb85 Remove to_ptr uses 2019-12-27 14:26:05 +01:00
Christian Poveda c8190e8de7 rename metadata struct 2019-12-26 19:31:59 -05:00
Christian Poveda 2151e958ce minor fixes and updated docs 2019-12-26 12:12:27 -05:00
Christian Poveda bbbb50a09a set mask for statx correctly 2019-12-25 22:24:18 -05:00
Christian Poveda 1bc3629084 do padding correctly 2019-12-25 18:22:33 -05:00
Christian Poveda d176259002 deduplicate shared code between stat and statx 2019-12-25 18:17:20 -05:00
Christian Poveda 515c119359 Add padding on 64-bits only 2019-12-25 13:10:50 -05:00
Christian Poveda 6d88a4704a restrict stat shim to macos only 2019-12-25 12:38:35 -05:00
Christian Poveda 75f7a118e6 remove restrictions due to stat unavailability 2019-12-25 12:38:34 -05:00
Christian Poveda dbc118919a add padding to immediates 2019-12-25 11:08:27 -05:00
Christian Poveda 0184e10f2f fix size for file mode 2019-12-25 08:27:50 -05:00
Christian Poveda b2c4ff2aee add remanining fields to stat stuct 2019-12-25 08:27:50 -05:00
Christian Poveda 6177e6df7e provide correct name for shim 2019-12-25 08:27:50 -05:00
Christian Poveda d9ecd77ada add dummy stat shim 2019-12-25 08:27:49 -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 bac261573f Rustup to rustc 1.42.0-nightly (005cf38f7 2019-12-22) 2019-12-23 23:02:36 +01:00
bors 02bba3f531 Auto merge of #1124 - RalfJung:sysroot-check, r=oli-obk
disable sysroot checks for distributed binaries

This should help with https://github.com/mozilla/nixpkgs-mozilla/issues/198.
2019-12-23 17:14:48 +00:00
Ralf Jung e325ad24f2 support main functions with Result return type 2019-12-23 17:45:23 +01:00
Oliver Scherer 7ead530841 Rustfmt all the things 2019-12-23 12:56:23 +01:00
Ralf Jung bc715cb646 disable sysroot checks for distributed binaries 2019-12-22 18:13:13 +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
Oliver Scherer 817f4159a2 Use the machine stop error instead of abusing other error kinds 2019-12-09 14:29:28 +01:00
Oliver Scherer eab2538317 Rename track-id to track-pointer-tag 2019-12-08 12:20:51 +01:00
Oliver Scherer 67417945d4 Detect all variants of stack removals 2019-12-08 12:20:51 +01:00
Oliver Scherer d363a47fcb Add a scheme to find the place where an id was destroyed 2019-12-08 12:20:51 +01:00
Ralf Jung 67151a712d rustup 2019-12-08 10:32:50 +01:00
Ralf Jung 0a63637e66 fix all-targets build 2019-12-07 19:04:05 +01:00
Ralf Jung e92d16d9cd add flag to ignore memory leaks 2019-12-07 13:44:48 +01:00
Ralf Jung edac086f1c rustup for find_fn rename 2019-12-04 23:31:39 +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
Ralf Jung 808ac8f4b9 use write_os_str_to_c_string for unix arg passing 2019-12-04 09:58:10 +01:00
Ralf Jung ab000997db use throw_machine_stop macro 2019-12-03 23:31:44 +01:00
Aaron Hill a418fe9826 Rustup for BodyCache changes 2019-12-02 20:21:03 -05:00
Ralf Jung 8e3c3eccc4 panic errors are actually still possible 2019-12-02 16:04:31 +01:00
Ralf Jung d43e394c46 fix init_allocation_extra 2019-12-02 16:04:31 +01:00
Ralf Jung e77258322c some error classes should be impossible 2019-12-02 16:04:31 +01:00
Ralf Jung 1b3434c67d adjust for init_allocation_extra 2019-12-02 16:04:31 +01: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