Commit Graph

472 Commits

Author SHA1 Message Date
Ralf Jung
d309804395 rustup 2021-02-03 23:37:40 +01:00
Ralf Jung
6f5a91f70a rustup 2021-01-31 13:12:25 +01:00
Ralf Jung
9d777d8410 add test for caller ABI check 2021-01-29 21:16:17 +01:00
Ralf Jung
0e56bff5f9 erroneous_const span now changes with inlining 2021-01-26 11:48:11 +01:00
Ralf Jung
7125b86c33 remove some unnecessary feature gates 2021-01-16 18:27:10 +01:00
Ralf Jung
a81ebd8fe3 rustup; add an interesting alias test case 2020-12-29 19:27:45 +01:00
JCTyBlaidd
aaf8ca4c77 Fix review changes 2020-12-13 11:04:58 +00:00
JCTyBlaidd
4e74f9f013 Change to disable mir-opt in compile-flags 2020-12-13 11:04:58 +00:00
JCTyBlaidd
a30105df0b Defeat the mir-opt=3 optimizer. 2020-12-13 11:04:58 +00:00
JCTyBlaidd
8676c60f87 Update note 2020-12-13 11:04:58 +00:00
JCTyBlaidd
296ba8b1c8 Fix bug with reporting wrong thread for races with reads & add thread ids to data-race tests 2020-12-13 11:04:58 +00:00
JCTyblaidd
c4ccd0b6a1 Fix nits
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-12-13 11:04:58 +00:00
JCTyBlaidd
f4bcef1113 Increase sleep times for the scheduler 2020-12-13 11:04:58 +00:00
JCTyBlaidd
c45b1b16be More tests, fix issue 1643 and detect races with allocation. 2020-12-13 11:04:58 +00:00
Ralf Jung
27a518e166 enable track-raw-ptr tests on Windows 2020-12-11 11:28:33 +01:00
Ralf Jung
7bbd6bca77 rustup 2020-12-10 19:53:45 +01:00
JCTyBlaidd
a6f377e48e Fix typo 2020-12-06 17:11:24 +00:00
JCTyBlaidd
4cf614ef33 Update release sequence handling to C++20 semantics. 2020-12-06 16:58:32 +00:00
bors
d473242ecd Auto merge of #1617 - JCTyblaidd:data_race_detector, r=RalfJung
Add simple data-race detector

Partially fixes data-race detection, see #1372, based on Dynamic Race Detection for C++11

- This does not explore weak memory behaviour, only exploring one sequentially consistent ordering.
- Data-race detection is only enabled after the first thread is created, so should have minimal overhead for non-concurrent execution.
- ~~Does not attempt to re-use thread id's so creating and joining threads lots of time in an execution will result in the vector clocks growing in size and slowing down program execution~~ It does now
2020-11-29 18:44:28 +00:00
JCTyBlaidd
55fc552d99 Apply review changes, incrementing the clocks twice is an unnecessary hold-over from earlier versions so fixed. 2020-11-27 19:26:06 +00:00
JCTyBlaidd
3268f56a97 Fix review changes 2020-11-22 17:28:12 +00:00
Ralf Jung
db718d72ae remove some unnecessary feature flags 2020-11-10 16:51:07 +01:00
JCTyBlaidd
2a40d9b7a0 More aggressive vector index re-use, and added some tests. 2020-11-06 17:29:54 +00:00
Ralf Jung
f31f00d5af rustup 2020-11-05 17:09:44 +01:00
JCTyBlaidd
95c99b2044 Detect races between atomic and non-atomic accesses of a variable,
previously only data races between two non-atomic accesses were
 detected.
2020-11-04 21:35:48 +00:00
JCTyBlaidd
fe2e857cc3 Add newlines at end of file + use replace.
add dangling thread variant of one of the benchmarks
2020-11-02 13:08:09 +00:00
JCTyBlaidd
2e75de5ac9 Mark all new tests as disabled on windows 2020-11-02 12:40:12 +00:00
JCTyBlaidd
ed32b260f9 Add tests, and fix bug in atomic RMW relaxed stores 2020-11-02 02:57:06 +00:00
Ralf Jung
bf54607ba0 test raw pointer tracking; we cannot track raw pointers on Windows 2020-10-28 13:54:50 +01:00
Aaron Hill
be51e6bd07
Add an fn_ptr field to MiriFrame
The `backtrace-rs` crate can use this to implement
`Frame::symbol_address`, which is used to skip frames
above the call to `Backtrace::capture` on the stack.

The function pointer will not be useable for comparison purposes if the
function is generic, as CTFE creates a new function pointer for each
cast of a (monomorphized) generic function. However, this already
affects code running under Miri, and isn't a problem for `backtrace-rs`
(which only casts a non-generic function).

I've added logic to allow `MiriFrame` to have either 4 or 5 fields - if
a 5th field is present, we write the function pointer to it.
2020-10-10 13:07:57 -04:00
Ralf Jung
b350c80a31 add backtics back in isolation error message 2020-10-03 15:25:30 +02:00
Mara Bos
5880e7d809 Update expected error messages in tests. 2020-10-03 12:00:29 +02:00
Aaron Hill
e1bce19ca9
Make some error messages lowercase 2020-09-28 13:44:45 -04:00
Aaron Hill
b89f6561e5
Move things around 2020-09-28 13:44:45 -04:00
Aaron Hill
ef43c5a614
Use a 'flags' parameter instead of 'version' 2020-09-28 13:44:45 -04:00
Aaron Hill
22f1eb01ee
Add API for capturing backtrace
This PR adds two new Miri-defined extern functions:
`miri_get_backtrace` and `miri_resolve_frame`, which are documented in
the README. Together, they allow obtaining a backtrace for the currently
executing program.

I've added a test showing how these APIs are used. I've also prepared a
companion PR `backtrace-rs`, which will allow
`backtrace::Backtrace::new()` to work automatically under Miri.

Once these two PRs are merged, we will be able to print backtraces from
the normal Rust panic hook (since libstd is now using backtrace-rs).

A few notes:
* Resolving the backtrace frames is *very* slow - you can actually see
  each line being printed out one at a time. Some local testing showed
  that this is not (primrary) caused by resolving a `Span` - it seems
  to be just Miri being slow.
* For the first time, we now interact directly with a user-defined
  struct (instead of just executing the user-provided MIR that
  manipulates the struct). To allow for future changes, I've added
  a 'version' parameter (currently required to be 0). This should allow
  us to change the `MiriFrame` struct should the need ever arise.
* I used the approach suggested by @oli-obk - a returned backtrace
  pointer consists of a base function allocation, with the 'offset'
  used to encode the `Span.lo`. This allows losslessly reconstructing
  the location information in `miri_resolve_frame`.
* There are a few quirks on the `backtrace-rs` side:
  * `backtrace-rs` calls `getcwd()` by default to try to simplify
    the filename. This results in an isolation error by default,
    which could be annoying when printing a backtrace from libstd.
  * `backtrace-rs` tries to remove 'internal' frames (everything between
     the call to `Backtrace::new()` and the internal API call made by
     backtrace-rs) by comparing the returned frame pointer value to
     a Rust function pointer. This doesn't work due to the way we
     construct the frame pointers passed to the caller. We could
     attempt to support this kind of comparison, or just add a
    `#[cfg(miri)]` and ignore the frames ourselves.
2020-09-28 13:44:45 -04:00
Ralf Jung
67c5067a2f rustup; fix tests 2020-09-24 09:19:03 +02:00
Ralf Jung
4b5e78052a rustup; support panic=abort on Windows 2020-09-20 15:55:36 +02:00
Ralf Jung
08e076c658 account for mir-opts masking more errors 2020-09-20 12:18:02 +02:00
Ralf Jung
83a339e5a9 rustup; make sure the iterator moves even with smarter optimizations 2020-09-20 10:26:22 +02:00
Ralf Jung
32cdb7131b support panic=abort 2020-09-18 13:10:18 +02:00
Samrat Man Singh
563fb8e43d Implement dup and close for stdin/stdout/stderr
Support F_DUPFD on stdin/stdout/stderr

Enable `close`-ing stdin/stdout/stderr

For `dup`, check if FD is `File` first

If not, clone the appropriate standard IO stream

Merge POSIX `close` and `dup` tests into same module

Also, add assertion that `write` on a closed FD returns an error.

Add `dup` as FileDescriptor trait fn

Also:
- Fix `close` so it drops `self` instead of reference to it
- Remove FD clamping in insert_fd_with_min_fd, since FDs 0-2 can be
closed

Fix fs_libc tests

Make error message when closing stdin/out/err more specific

Return io::Result from `FileDescriptor::dup`

Change error message when closing stdin/out/err

Refactor `FileDescriptor::dup` impl for `FileHandle`

Remove empty line
2020-09-09 23:26:33 +05:30
Ralf Jung
3ba1035d27 use standard black_box function 2020-09-07 11:29:47 +02:00
Ralf Jung
029c851d7c another optimization work-around 2020-09-07 11:23:09 +02:00
Ralf Jung
088af66f85
better optimization suppression
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2020-09-07 11:16:16 +02:00
Ralf Jung
210f18d6c7 work around rustc optimizations becoming too smart 2020-09-07 10:24:38 +02:00
Ralf Jung
237bea2c17 avoid promotion in alignment test to get different alignment on each try 2020-08-20 10:14:13 +02:00
Ralf Jung
d5b15297ac forgot to add alignment test loop in one test 2020-08-18 10:19:29 +02:00
Ralf Jung
5b1bc4ba94 make another test more robust against random alignment 2020-08-17 18:22:46 +02:00
Ralf Jung
cb985670c1 make alignment check integer-based by default, and add an option to make it symbolic 2020-08-16 17:08:38 +02:00