Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miri subtree update #119574

Merged
merged 14 commits into from
Jan 4, 2024
Merged

Miri subtree update #119574

merged 14 commits into from
Jan 4, 2024

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Jan 4, 2024

r? @ghost

beepster4096 and others added 13 commits December 25, 2023 17:09
Co-authored-by: Jefffrey <[email protected]>
Co-authored-by: Ralf Jung <[email protected]>
Support for tempfile crate on UNIX hosts

Reviving old PR: rust-lang/miri#2720

Attempted to apply the changes as suggested by rust-lang/miri#2720 (comment)

To fix tempfile to work for UNIX targets only and fall back to previous behaviour of only supporting default mode for Windows targets
NaN non-determinism for intrinsics and libm functions
Fix integer overflow ICEs from round_up_to_next_multiple_of

Turns out the standard library _does_ have the function we need. So I swapped us to using the checked version in mmap/munmap where we can return an error, and we're still using the ICEy version in SIMD.

I found one of the ICE cases by running this test: https://github.com/wbcchsyn/rust-mmap-allocator/blob/765bcaab6e3bfd1cb1e6eaac80ac7e821fb5979b/src/mmap_allocator.rs#L195-L210
…Jung

Use `windows-sys` in windows tests

This PR adds `windows-sys` to `test_dependencies` so that we don't have to write out windows api bindings for each test.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 4, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jan 4, 2024

The Miri subtree was changed

cc @rust-lang/miri

@RalfJung
Copy link
Member Author

RalfJung commented Jan 4, 2024

@bors r+ p=1

@bors
Copy link
Contributor

bors commented Jan 4, 2024

📌 Commit 38847ae has been approved by RalfJung

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 4, 2024
@RalfJung
Copy link
Member Author

RalfJung commented Jan 4, 2024

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 4, 2024
@RalfJung
Copy link
Member Author

RalfJung commented Jan 4, 2024

Very strange...

   +error: Undefined Behavior: calling a function with ABI system using caller ABI C
  +  --> $DIR/windows_join_multiple.rs:LL:CC
  +   |
  +LL |         assert_eq!(WaitForSingleObject(blocker, INFINITE), WAIT_OBJECT_0);
  +   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function with ABI system using caller ABI C

Likely caused by rust-lang/miri#3239. @beepster4096 any idea why this would pass on Miri CI but now fail here? Did the windows crate recently change which ABI it uses for these functions? But even then, our test suite should be using pinned versions...

@RalfJung
Copy link
Member Author

RalfJung commented Jan 4, 2024

Hm, there do seem to be some conditions under which these functions get a different ABI? Specifically, #[cfg(all(windows_raw_dylib, not(target_arch = "x86")))]. x86-64 is not x86. I can't quite figure out where windows_raw_dylib comes from.

But it seems just plain wrong to have this sometimes be a "C" function and sometimes a "system" function?

@RalfJung
Copy link
Member Author

RalfJung commented Jan 4, 2024

I guess the Miri build is somehow picking up this:

// By default, windows-rs depends on a native library that doesn't get copied into the
// sysroot. Passing this cfg enables raw-dylib support instead, which makes the native
// library unnecessary. This can be removed when windows-rs enables raw-dylib
// unconditionally.
if let Mode::Rustc | Mode::ToolRustc = mode {
rustflags.arg("--cfg=windows_raw_dylib");
}

@RalfJung
Copy link
Member Author

RalfJung commented Jan 4, 2024

I think I have found a work-around; @oli-obk please have a look.

But it'd also be good if someone could look into why windows-rs uses a different ABI for the same function depending on this --cfg windows_raw_dylib flag, that seems suspicious (and there's no comment explaining why this happens).

EDIT: I found out why it happens: to work around other things (#110505). What a chain of unfortunateness.

@oli-obk
Copy link
Contributor

oli-obk commented Jan 4, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Jan 4, 2024

📌 Commit 5aa15b6 has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 4, 2024
Comment on lines +114 to +115
// Reset `RUSTFLAGS` to work around <https://github.com/rust-lang/rust/pull/119574#issuecomment-1876878344>.
config.dependency_builder.envs.push(("RUSTFLAGS".into(), None));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems generally good to me. We should mostly isolate tests from their environment

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 4, 2024
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#117636 (add test for rust-lang#117626)
 - rust-lang#118704 (Promote `riscv32{im|imafc}` targets to tier 2)
 - rust-lang#119184 (Switch from using `//~ERROR` annotations with `--error-format` to `error-pattern`)
 - rust-lang#119325 (custom mir: make it clear what the return block is)
 - rust-lang#119391 (Use Result::flatten in catch_with_exit_code)
 - rust-lang#119431 (Support reg_addr register class in s390x inline assembly)
 - rust-lang#119475 (Remove libtest's dylib)
 - rust-lang#119532 (Make offset_of field parsing use metavariable which handles any spacing)
 - rust-lang#119553 (stop feed vis when cant access for trait item)
 - rust-lang#119574 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6579378 into rust-lang:master Jan 4, 2024
11 checks passed
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 4, 2024
Rollup merge of rust-lang#119574 - RalfJung:miri, r=oli-obk

Miri subtree update

r? `@ghost`
@rustbot rustbot added this to the 1.77.0 milestone Jan 4, 2024
@RalfJung RalfJung deleted the miri branch January 5, 2024 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants