Commit Graph

483 Commits

Author SHA1 Message Date
Ralf Jung
893843fd45 when Miri calls a function ptr, make sure it has the right ABI 2021-03-14 15:30:37 +01:00
Ralf Jung
98f28ac9c8 rustup 2021-03-11 09:07:05 +01:00
Ralf Jung
7a7f7b1a7a rustup 2021-03-10 15:21:12 +01:00
Smitty
26e97ec54f Support breakpoint intrinsic 2021-03-04 07:48:28 -05:00
Ralf Jung
97e45e0699 make optimized-test-run a bit more like what cargo does 2021-03-02 11:04:35 +01:00
Ralf Jung
7acf80d2bb rustup; fix tests for new MIR optimization 2021-03-02 10:57:08 +01:00
Ralf Jung
48f7c8e2e6 fix reborrowing of tagged ZST references 2021-02-27 20:10:50 +01:00
Ralf Jung
c003fd0157 rustup 2021-02-23 09:23:49 +01:00
Ralf Jung
a5a751e795 rustup 2021-02-17 09:37:21 +01:00
Ralf Jung
4c867feeb6 add test by @eddyb 2021-02-16 10:18:31 +01:00
Ralf Jung
0b3dba8e70 rustup and temporarily disable broken tests 2021-02-16 09:55:33 +01:00
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