Commit Graph

7003 Commits

Author SHA1 Message Date
Oli Scherer
6a29a6842a Clippy after rustup 2022-09-02 13:55:26 +00:00
Oli Scherer
7155a2190e Rustup 2022-09-02 13:55:18 +00:00
bors
92c24c4c37 Auto merge of #2529 - RalfJung:yesffi, r=RalfJung
re-enable FFI support

https://github.com/tov/libffi-rs/pull/58 landed so the license should no longer be an issue. :)

Fixes https://github.com/rust-lang/miri/issues/2526
2022-09-02 12:41:03 +00:00
Ralf Jung
2f348abafc Revert "disable extern-so ffi support for now due to licensing situation"
This reverts commit 5f3545e773.
With https://github.com/tov/libffi-rs/pull/58 landed, we no longer depend on abort_on_panic.
2022-09-02 14:39:25 +02:00
bors
8c8b479be7 Auto merge of #2527 - RalfJung:noffi, r=RalfJung
disable extern-so ffi support for now due to licensing situation

libffi depends on abort_on_panic which has a [very unfortunate license situation going on](https://rust-lang.zulipchat.com/#narrow/stream/231349-t-core.2Flicensing). For now, in order to let us update Miri in rustc, I see no way but to disable our FFI support again. Sorry `@emarteca` :(

Cc https://github.com/rust-lang/miri/issues/2526
2022-09-01 20:28:06 +00:00
Ralf Jung
5f3545e773 disable extern-so ffi support for now due to licensing situation 2022-09-01 22:25:14 +02:00
bors
2d50443401 Auto merge of #2523 - saethlin:protector-test, r=RalfJung
Add a protector test that demonstrates the base tag diagnostic

Per https://github.com/rust-lang/miri/pull/2519#issuecomment-1232736295, this demonstrates this case for protector diagnostics:
```
help: <3131> was created here, as a base tag for alloc1623
  --> tests/fail/stacked_borrows/invalidate_against_protector3.rs:10:19
   |
10 |         let ptr = std::alloc::alloc(std::alloc::Layout::for_value(&0i32)) as *mut i32;
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
This diagnostic is inspired by what Miri used to do with https://github.com/rust-lang/rust/issues/60076#issuecomment-1214169179
2022-09-01 13:49:27 +00:00
bors
8218248fd1 Auto merge of #2525 - RalfJung:zulip, r=RalfJung
Zulip notifications: ping the Miri team
2022-09-01 13:22:04 +00:00
Ralf Jung
e12962b4aa Zulip notifications: ping the Miri team 2022-09-01 15:20:05 +02:00
Ben Kimock
3cfb9915fc Add a protector test that demonstrates the base tag diagnostic 2022-08-31 21:37:44 -04:00
bors
0da5f76a92 Auto merge of #2516 - RalfJung:read-pointer-as-bytes, r=RalfJung
Adjust for supporting more implicit ptr-to-int transmutation

This is the Miri side of https://github.com/rust-lang/rust/pull/101101.
Fixes https://github.com/rust-lang/miri/issues/2456.
2022-08-31 16:25:06 +00:00
Ralf Jung
0113f9e727 rustup 2022-08-31 18:19:14 +02:00
Ralf Jung
d21b601b6e make Miri build again with rustc provenance changes 2022-08-31 18:19:09 +02:00
bors
95b315d7f6 Auto merge of #2524 - RalfJung:progress-report, r=RalfJung
fix progress report being deduplicated

Fixes https://github.com/rust-lang/miri/issues/2522
2022-08-31 15:33:17 +00:00
Ralf Jung
1135ad31ab make shim_arg_size ptr-width-independent 2022-08-31 17:32:39 +02:00
Ralf Jung
671a4b8b0f make backtrace header a bit more visible 2022-08-31 17:32:39 +02:00
Ralf Jung
4cb26afc0c fix progress report being deduplicated 2022-08-31 15:59:53 +02:00
bors
feeeba2925 Auto merge of #2521 - oli-obk:bump_ui_test, r=RalfJung
Bump UI test dependency

This gives us the new diff renderer as well as the ability to run tests without parallelism if we'd want to.
2022-08-31 11:37:27 +00:00
Ralf Jung
240f92aae8
add comment 2022-08-31 13:36:25 +02:00
Oli Scherer
eafc100b50 Bump ui_test to 0.3.1 2022-08-31 11:06:35 +00:00
Oli Scherer
b74654f25c Bump UI test dependency 2022-08-31 10:27:50 +00:00
bors
da45adc622 Auto merge of #2519 - saethlin:rustup, r=RalfJung
Use the better FnEntry spans in protector errors

Example error, from `tests/fail/stacked_borrows/invalidate_against_protector1.rs`:
```
error: Undefined Behavior: not granting access to tag <3095> because that would remove [Unique for <3099>] which is protected because it is an argument of call 943
  --> tests/fail/stacked_borrows/invalidate_against_protector1.rs:5:25
   |
5  |     let _val = unsafe { *x }; //~ ERROR: protect
   |                         ^^ not granting access to tag <3095> because that would remove [Unique for <3099>] which is protected because it is an argument of call 943
   |
   = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
   = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <3095> was created by a SharedReadWrite retag at offsets [0x0..0x4]
  --> tests/fail/stacked_borrows/invalidate_against_protector1.rs:10:16
   |
10 |     let xraw = &mut x as *mut _;
   |                ^^^^^^
help: <3099> is this argument
  --> tests/fail/stacked_borrows/invalidate_against_protector1.rs:1:23
   |
1  | fn inner(x: *mut i32, _y: &mut i32) {
   |                       ^^
   = note: backtrace:
   = note: inside `inner` at tests/fail/stacked_borrows/invalidate_against_protector1.rs:5:25
note: inside `main` at tests/fail/stacked_borrows/invalidate_against_protector1.rs:12:5
  --> tests/fail/stacked_borrows/invalidate_against_protector1.rs:12:5
   |
12 |     inner(xraw, xref);
   |     ^^^^^^^^^^^^^^^^^
```

Benchmarks report no change, within noise.
2022-08-31 10:06:05 +00:00
Ben Kimock
da0d4829bf Use the better FnEntry spans in protector errors 2022-08-29 18:06:30 -04:00
bors
284b59c4dc Auto merge of #2517 - saethlin:zst-field-retagging, r=RalfJung
Skip field retagging on ZSTs, it can take forever

I just tried running the `alloc`'s tests with `miri-test-libstd` with field retagging enabled. The test suite eventually hangs on a few tests which pass around ZSTs that have a lot of fields.

I don't really know how to test this effectively. The test passes, but if you remove this fast-path it effectively just hangs the interpreter. And since it hangs _inside_ a step, there's no hope for doing some kind of timeout within the test.
2022-08-29 11:46:26 +00:00
Ralf Jung
c9b36b4ded
clarify test purpose 2022-08-29 07:46:03 -04:00
Ben Kimock
70b960b879 Skip field retagging on ZSTs, it can take forever 2022-08-29 00:31:46 -04:00
bors
fec1c7aa32 Auto merge of #2513 - RalfJung:protected, r=saethlin
slightly improve protector-related error messages

I find the current retag messages confusing, since they sound like the item *was* protected, when it still actively *is* protected (and that is, in fact, the issue).

Example error message:
```
error: Undefined Behavior: not granting access to tag <3095> because incompatible item [Unique for <3099>] is protected by call 943
  --> tests/fail/stacked_borrows/invalidate_against_barrier1.rs:5:25
   |
5  |     let _val = unsafe { *x }; //~ ERROR: protect
   |                         ^^ not granting access to tag <3095> because incompatible item [Unique for <3099>] is protected by call 943
   |
   = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
   = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <3095> was created by a SharedReadWrite retag at offsets [0x0..0x4]
  --> tests/fail/stacked_borrows/invalidate_against_barrier1.rs:10:16
   |
10 |     let xraw = &mut x as *mut _;
   |                ^^^^^^
help: <3095> cannot be used for memory access because that would remove protected tag <3099>, protected by this function call
  --> tests/fail/stacked_borrows/invalidate_against_barrier1.rs:1:1
   |
1  | / fn inner(x: *mut i32, _y: &mut i32) {
2  | |     // If `x` and `y` alias, retagging is fine with this... but we really
3  | |     // shouldn't be allowed to use `x` at all because `y` was assumed to be
4  | |     // unique for the duration of this call.
5  | |     let _val = unsafe { *x }; //~ ERROR: protect
6  | | }
   | |_^
help: <3099> was derived from <3098>, which in turn was created here
  --> tests/fail/stacked_borrows/invalidate_against_barrier1.rs:12:17
   |
12 |     inner(xraw, xref);
   |                 ^^^^
   = note: backtrace:
   = note: inside `inner` at tests/fail/stacked_borrows/invalidate_against_barrier1.rs:5:25
note: inside `main` at tests/fail/stacked_borrows/invalidate_against_barrier1.rs:12:5
  --> tests/fail/stacked_borrows/invalidate_against_barrier1.rs:12:5
   |
12 |     inner(xraw, xref);
   |     ^^^^^^^^^^^^^^^^^
```

r? `@saethlin`
2022-08-28 16:01:49 +00:00
Ralf Jung
abe890d2ce slightly improve protector-related error messages
also rename some tests that still used outdated "barrier" terminology
2022-08-28 09:27:10 -04:00
bors
88665133b7 Auto merge of #2512 - cbeuw:scfix, r=RalfJung
Strengthen C++20 SC accesses

`@SabrinaJewson` noted in #2301 that Miri could produce behaviours forbidden under C++20 even without SC fences. Due to the added coherence-ordered before relationship which is created from read from and read before, plus the fact that coherence-ordered before between SC operations must be consistent with the Global Total Order S, in C++20 if there's an SC load that reads from any store, then a later SC load cannot read before that store. This PR adds this restriction
2022-08-28 13:20:54 +00:00
Andy Wang
3e97d8e65f
Comment deviations from the paper 2022-08-28 11:05:06 +01:00
bors
74d99abac0 Auto merge of #2515 - RalfJung:build, r=RalfJung
dont rerun build script unnecessarily
2022-08-27 20:24:54 +00:00
Ralf Jung
d39b683053 dont rerun build script unnecessarily 2022-08-27 16:08:05 -04:00
bors
12907ab4d7 Auto merge of #2514 - RalfJung:dont-compare, r=RalfJung
ensure we don't compare provenance

Comparing provenance is meaningless, since `Wildcard` might be any provenance.
2022-08-27 19:56:35 +00:00
Ralf Jung
b4eff16e0c ensure we don't compare provenance 2022-08-27 15:56:00 -04:00
Andy Wang
6dea99ec71
Supress clippy error 2022-08-27 15:24:59 +01:00
Andy Wang
0f9e009987
Fix C++20 SC access unsoundness 2022-08-27 15:24:57 +01:00
Andy Wang
a2467c9b2a
Add C++20 SC access test 2022-08-27 15:24:25 +01:00
Andy Wang
01dffe0575
Remove useless store buffer search logging 2022-08-27 15:24:25 +01:00
Andy Wang
f4ba8b1160
Improve SC comments 2022-08-27 15:24:24 +01:00
bors
bb8212484f Auto merge of #2455 - RalfJung:scalar-always-init, r=RalfJung
adjust for earlier init checking in the core engine

Miri side of https://github.com/rust-lang/rust/pull/100043
2022-08-27 13:17:31 +00:00
Ralf Jung
df19b856ce rustup 2022-08-27 08:57:06 -04:00
Ralf Jung
3a2252b7b3 adjust for earlier init checking in the core engine 2022-08-27 08:51:28 -04:00
bors
101c4f2e38 Auto merge of #2511 - RalfJung:extern-so, r=RalfJung
some extern-so cleanup and fixes
2022-08-26 21:44:32 +00:00
Ralf Jung
235036fcb3 nicer errors 2022-08-26 17:43:04 -04:00
Ralf Jung
82802337a8 rename test to match usual naming conventions
what's a "fcts"?
2022-08-26 17:40:26 -04:00
Ralf Jung
4e017b54ad fix host/target check for extern-so 2022-08-26 17:38:59 -04:00
bors
4ae68749f7 Auto merge of #2510 - oli-obk:merge_conflict, r=oli-obk
Fix merge conflict

found in https://github.com/rust-lang/miri/pull/2363#discussion_r956100939
2022-08-26 14:38:14 +00:00
Oli Scherer
fa1e51ae7d Fix merge conflict 2022-08-26 14:35:40 +00:00
bors
515038ed7d Auto merge of #2509 - RalfJung:env-data-race, r=RalfJung
fix data race error during env var cleanup

Fixes https://github.com/rust-lang/miri/issues/2508
2022-08-26 13:33:40 +00:00
Ralf Jung
10a1a59c4b fix data race error during env var cleanup 2022-08-26 09:32:30 -04:00