Commit graph

2529 commits

Author SHA1 Message Date
bjorn3
42cb1ffa36 Directly implement native exception raise methods in miri
Windows still needs the old custom ABI as SEH unwinding isn't supported
by miri. Unlike DWARF unwinding it preserves all stack frames until
right after the do_catch function has executed. Because of this
panic_unwind stack allocates the exception object. Miri can't currently
model unwinding without destroying stack frames and as such will report
a use-after-free of the exception object.
2024-05-19 19:06:31 +02:00
Ralf Jung
b8a7c73792 test wasm32-wasip2 instead of the deprecated wasm32-wasi target 2024-05-19 16:48:48 +02:00
Ralf Jung
2b9c1caa18 properly print error in 'cargo miri setup --print-sysroot' 2024-05-19 14:01:52 +02:00
bors
0e41a801f3 Auto merge of #3616 - RalfJung:android, r=RalfJung
make basic things work on Android

Fixes https://github.com/rust-lang/miri/issues/3608
2024-05-19 10:14:36 +00:00
bors
3726afad7e Auto merge of #3585 - devnexen:aligned_alloc, r=RalfJung
support aligned_alloc for unixes.

Fixes https://github.com/rust-lang/miri/issues/3577
2024-05-19 09:50:25 +00:00
Ralf Jung
844de64396 make basic things work on Android 2024-05-19 11:50:12 +02:00
Ralf Jung
430298c3ad a bit of refactoring and tweak the aligned-allocation tests 2024-05-19 11:48:51 +02:00
Ralf Jung
1ba83f2dc1 Preparing for merge from rustc 2024-05-19 10:35:38 +02:00
David Carlier
5ea21ca486
support aligned_alloc for unixes support. 2024-05-18 12:45:34 +01:00
marc0246
318a0fe586
Ignore the Helix configuration directory 2024-05-17 22:58:25 +02:00
bors
5b2fdb6d40 Auto merge of #3603 - Luv-Ray:issue-3572, r=RalfJung
Give `FileDescription::{read, write}` access to the `MiriInterpCx `

fixes #3572
2024-05-17 16:36:33 +00:00
bors
fffc8e9b43 Auto merge of #3526 - Strophox:miri-memory, r=RalfJung
Adjust Allocation Bytes used by Miri to custom MiriAllocBytes

Previously, the `MiriMachine` used `type Bytes = Box<[u8]>` for its allocations.
This PR swaps this out for a custom `MiriAllocBytes` type implemented in `alloc_bytes.rs`.
This is in anticipation of an extension to Miri's FFI, which will require its allocations to take care of alignment (the methods in `impl AllocBytes for Box<[u8]>` ignore this `_align: Align` argument).

Needs https://github.com/rust-lang/rust/pull/124492
2024-05-17 06:19:50 +00:00
Strophox
983fb093ff start implementing MiriAllocBytes
attempt changing Bytes in MiriMachine to MiriAllocBytes

rename miri_alloc_bytes to alloc_bytes

generalize impl VisitProvenance for Allocation for any Bytes: AllocBytes

mend MiriAllocBytes -> Self::Bytes

fix Invariant documentation and bugs (drop), impl Clone

Update MiriAllocBytes description

Co-authored-by: Ralf Jung <post@ralfj.de>

Rephrase MiriAllocBytes ptr invariant

Co-authored-by: Ralf Jung <post@ralfj.de>

Update MiriAllocBytes ptr documentation

Co-authored-by: Ralf Jung <post@ralfj.de>

fix safety comment in MiriAllocBytes::clone

fix safety comment in MiriAllocBytes::from_bytes

try implementing clone without unsafe

remove derive(PartialEq,Eq,Hash), fix fmt

move ptr.is_null() check inside only necessary branch

use std::ptr::without_provenance_mut, requiring feature(strict_provenance)

align.bytes_usize() instead of align.bytes().try_into().unwrap()

Update src/provenance_gc.rs

Co-authored-by: Ralf Jung <post@ralfj.de>

fix clippy error on deref
2024-05-16 16:04:20 +02:00
Ralf Jung
6d314f3b11 alloc now works on wasi (and some formatting) 2024-05-16 11:25:44 +02:00
Ralf Jung
b1b278b17b Preparing for merge from rustc 2024-05-16 10:40:05 +02:00
Luv-Ray
99c6b2e604 Give FileDescription::{read, write} access to the InterpCx 2024-05-13 16:17:56 +08:00
bors
d0b2c6611b Auto merge of #3604 - RalfJung:intrinsics, r=RalfJung
intrinsics: just panic when they get used incorrectly

This is already what we do most of the time, so do it consistently.
2024-05-13 06:24:47 +00:00
Ralf Jung
c6a0e2ca4c intrinsics: just panic when they get used incorrectly 2024-05-13 08:21:05 +02:00
bors
d4937cb229 Auto merge of #3575 - devnexen:illumos_part3, r=RalfJung
Illumos part3

Fixes https://github.com/rust-lang/miri/issues/3567
2024-05-12 20:33:36 +00:00
David Carlier
10acfd9f77 further illumos/solaris support.
fixing part of `miri test alloc/hashmap`.
2024-05-12 19:59:09 +00:00
bors
e4f81d1bb2 Auto merge of #3599 - saethlin:quiet-when-no-change, r=RalfJung
Don't print unnecessary sysroot messages

Currently, when running `cargo miri setup`, we always print that a sysroot is being prepared, even if we just bail out of building after checking the hash. So that message is wrong; we didn't actually prepare a sysroot.

We also always print the preparing message for `cargo miri run`, even if no sysroot is prepared.

With this PR, `cargo miri run` prints no sysroot messages when an existing one is reused, and when a redundant `cargo miri setup` is requested, we print:
```
A sysroot for Miri is already available in `/home/ben/.cache/miri`.
```
2024-05-12 18:35:24 +00:00
Ben Kimock
cd7527aa35 Don't print unnecessary sysroot messages 2024-05-12 14:31:22 -04:00
Ralf Jung
7d565dfa0f Preparing for merge from rustc 2024-05-12 15:44:17 +02:00
Ralf Jung
01b5430b28 merge two integer tests 2024-05-12 10:25:51 +02:00
Ralf Jung
5d76ec9cdd merge float tests into one 2024-05-12 10:21:00 +02:00
Ralf Jung
9fc569d67f organize float intrinsic implementations a bit 2024-05-12 10:12:33 +02:00
tiif
bf5906fbb4 Add non-null pointer for posix_memalign 2024-05-12 15:01:18 +08:00
bors
32b2238174 Auto merge of #3596 - bend-n:support_fstar_algebraic, r=RalfJung
support `f*_algebraic`

supports the [`f*_algebraic`](https://doc.rust-lang.org/std/intrinsics/fn.fadd_algebraic.html) intrinsics.
2024-05-11 10:32:28 +00:00
bendn
e928185f6e
support f*_algebraic 2024-05-11 17:13:20 +07:00
bors
79a85d4e99 Auto merge of #3598 - RalfJung:heap, r=RalfJung
alloc: update comments around malloc() alignment

Also separate the C heap shims form the Windows heap shims; their guarantees aren't quite the same.
2024-05-11 08:53:42 +00:00
Ralf Jung
01b151ebd4 separate windows heap functions from C heap shims 2024-05-11 10:52:08 +02:00
Ralf Jung
7a0ee91ba5 alloc: update comments around malloc() alignment 2024-05-11 10:52:02 +02:00
The Miri Cronjob Bot
ce3daac283 Merge from rustc 2024-05-11 05:03:34 +00:00
The Miri Cronjob Bot
4d63d0af4d Preparing for merge from rustc 2024-05-11 04:56:14 +00:00
Ralf Jung
25a3b6687e rename 'extern-so' to 'native-lib' 2024-05-10 18:30:48 +02:00
Matthias Krüger
9a9ec90567
Rollup merge of #124957 - compiler-errors:builtin-deref, r=michaelwoerister
Make `Ty::builtin_deref` just return a `Ty`

Nowhere in the compiler are we using the mutability part of the `TyAndMut` that we used to return.
2024-05-10 16:10:47 +02:00
Michael Goulet
d50c2b0a52 Make builtin_deref just return a Ty 2024-05-09 22:55:00 -04:00
Ralf Jung
41d36a0951 interpret/miri: better errors on failing offset_from 2024-05-09 13:09:47 +02:00
bors
d3f4d06c15 Auto merge of #3591 - RalfJung:win-symlink-trouble, r=RalfJung
do not run symlink tests on Windows hosts

Fixes https://github.com/rust-lang/miri/issues/3587
2024-05-09 10:30:11 +00:00
Ralf Jung
1edd3d59b0 do not run symlink tests on Windows hosts 2024-05-09 12:28:53 +02:00
Ralf Jung
cb44843900 make RUSTC_BLESS entirely an internal thing 2024-05-09 11:27:22 +02:00
Ralf Jung
e16f46cdab make MIRI_TEST_TARGET entirely an internal thing 2024-05-09 11:27:22 +02:00
bors
42d9b6890e Auto merge of #3588 - RossSmyth:CliTarget, r=RalfJung
Allow test targets to be set via CLI args

Fixes #3584

I'm not a pro shell script reader as I am a Windows user, but we shall see if the CI script broke.
2024-05-09 07:41:43 +00:00
Ralf Jung
d43cb7121e minor tweaks 2024-05-09 09:40:13 +02:00
Ross Smyth
620bf348e1 Update documentation for miri-script test changes 2024-05-08 18:05:28 -04:00
Ross Smyth
6e564ed9fd Update CI script for the miri-script test changes 2024-05-08 18:05:28 -04:00
Ross Smyth
6580a22726 Allow test targets to be set via CLI args 2024-05-08 18:05:26 -04:00
Matthias Krüger
3e22ea9e2f
Rollup merge of #124876 - nnethercote:rm-use-crate-rustc_foo, r=compiler-errors
Simplify `use crate::rustc_foo::bar` occurrences.

They can just be written as `use rustc_foo::bar`, which is far more standard. (I didn't even know that a `crate::` prefix was valid.)

r? ``@eholk``
2024-05-08 23:33:26 +02:00
bors
2e1d417e70 Auto merge of #3580 - tiif:feat/malloc0-non-null-pointer, r=RalfJung
Implement non-null pointer for malloc(0)

Use non-null pointer for malloc(0) as mentioned in  #3576 to detect leaks and double free of ``malloc(0)`` addresses.
2024-05-08 20:50:38 +00:00
tiif
4ab79e5622 Implement non-null pointer for malloc(0) 2024-05-09 04:34:32 +08:00