235102 Commits

Author SHA1 Message Date
bors
375ff3e5ce Auto merge of #3110 - eduardosm:rounding-without-host-floats, r=RalfJung
Do not use host floats in `simd_{ceil,floor,round,trunc}`
2023-10-06 15:44:37 +00:00
bors
3c511bb417 Auto merge of #3067 - Vanille-N:spurious-incremental, r=RalfJung
Continuation of #3054: enable spurious reads in TB

The last additions to the test suite of TB left some unresolved `#[should_panic]` that these new modifications solve.

## Problem

Recall that the issues were arising from the interleavings that follow.

### A. `Reserved -> Frozen` has visible effects after function exit

The transition `Reserved -> Frozen` irreversibly blocks write accesses to the tag, so in the interleaving below `y` initially `Reserved` becomes `Frozen` only in the target where a spurious read through `x` is inserted. This makes the later write through `y` UB only in the target and not in the source.
```
1: retag x (&, protect)
2: retag y (&mut, protect)
1: spurious read x
1: ret x
2: ret y
2: write y
```

### B. Protectors only announce their presence on retag

There is a read-on-reborrow for protected locations, but if the retag of `x` occurs before that of `y` and there is no explicit access through `x`, then `y` is unaware of the existence of `x`. This is problematic because a spurious read inserted through `x` between the retag of `y` and the return of the function protecting `x` is a noalias violation in the target without UB in the source.
```
1: retag x (&, protect)
2: retag y (&mut, protect)
1: spurious read x
1: ret x
2: write y
2: ret y
```

## Step 1: Finer behavior for `Reserved`

Since one problem is that `Reserved -> Frozen` has consequences beyond function exit, we decide to remove this transition entirely. To replace it we introduce a new subtype of `Reserved` with the extra boolean `aliased` set.
`Reserved { aliased: true }` forbids child accesses, but only temporarily: it has no effect on activation once the tag is no longer protected.
This makes the semantics of Tree Borrows slightly weaker in favor of being more similar to noalias.

This solves interleaving **A.**, but **B.** is still a problem and the exhaustive tests do not pass yet.

## Step 2: Read on function exit

Protected tags issue a "reminder" that they are protected until this instant inclusive, in the form of an implicit read (symmetrically to the implicit read on retag). This ensures that if the periods on which two tags `x` and `y` are protected overlap then no matter the interleaving of retags and returns, there is either a protector currently active or a read that has been emitted, both of which temporarily block activation.

This makes the exhaustive test designed previously pass, but it has an effect on the ability to return an activated pointer that I had not foreseen before implementing it.

## Step 2': Do not propagate to children

A naive implementation of **Step 2** makes the following code UB:
```rs
fn reborrow(x: &mut u8) -> &mut u8 {
    let y = &mut *x;
    *y = *y;
    y // callee returns `y: Active`...
}

let x = &mut 0u8;
let y = reborrow(x); // ... and caller receives `y: Frozen`
*y = 1; // UB
```
This is unacceptable, and a simple fix is to make this implicit read visible only to foreign tags.

We still lack hindsight on the ramifications of this decision, and the fact that the problematic pattern was only discovered because it occured in one completely unrelated test (with a cryptic error message) is worrying. We should be vigilant as to how this interacts with the rest of the model.

## TODO

As of commit #281c30, the data race model has not been fully updated.
We have removed the reborrow of mutable references counting as a write access, but we still need the implicit read of function exit to count as a read.
2023-10-06 14:58:31 +00:00
Eduardo Sánchez Muñoz
e1e880e9c6 Do not use host floats in simd_{ceil,floor,round,trunc} 2023-10-06 15:12:36 +02:00
Neven Villani
bf1356efc3
Fix problems of Reserved -> Frozen
Reserved loses permissions too quickly.
Adding more fine-grained behavior of Reserved lets it lose
write permissions only temporarily.
Protected tags receive a read access on initialized locations.
2023-10-06 14:37:07 +02:00
bors
4587c7c1c0 Auto merge of #3109 - RalfJung:dlsym, r=RalfJung
add a direct dlsym test
2023-10-06 09:11:14 +00:00
Ralf Jung
03a03e2ef6 add a direct dlsym test 2023-10-06 11:09:58 +02:00
bors
413540837b Auto merge of #3108 - RalfJung:dlsym, r=RalfJung
refactor dlsym: dispatch symbols via the normal shim mechanism

This avoids having to adjust Miri when switching between invoking the function via a linked symbol vs via dlsym.
2023-10-06 07:40:47 +00:00
Ralf Jung
16cde069fc allow dyn_sym in the files where they are defined; remove unreachable android code 2023-10-06 09:38:50 +02:00
Ralf Jung
099311ba5a make some things on foreign_items private 2023-10-06 09:23:56 +02:00
Ralf Jung
bc8d4dfa95 refactor dlsym: dispatch symbols via the normal shim mechanism 2023-10-06 09:23:35 +02:00
bors
f9003c08ab Auto merge of #3098 - BlackHoleFox:apple-entropy, r=RalfJung
Support getentropy on macOS as a foreign item

Prior this was always assumed to be accessed via `dlsym` shim, but in `std` I'm attempting to start [unconditionally linking](https://github.com/rust-lang/rust/pull/116319) to `getentropy` on macOS now that Rust's platform version support allows it.

This just moves the main logic of the previous `dlsym` handler into an eval context extension so it can be used via both call paths. The `dlsym` handler is still needed as `getrandom` uses it.
2023-10-06 05:52:07 +00:00
BlackHoleFox
dff7d5aa2f Move getentropy handling to a shared location for foreign item implementation 2023-10-06 00:37:42 -05:00
bors
1a6ab015d0 Auto merge of #3107 - eduardosm:update-deps, r=RalfJung
Update dependencies
2023-10-05 22:07:09 +00:00
Eduardo Sánchez Muñoz
11afb99b4f Update test dependencies 2023-10-05 19:30:31 +02:00
Eduardo Sánchez Muñoz
bbebfa7186 Update miri-script dependencies 2023-10-05 19:29:27 +02:00
Eduardo Sánchez Muñoz
f49d325f9d Update cargo-miri dependencies 2023-10-05 19:29:02 +02:00
Eduardo Sánchez Muñoz
95c4590988 Update miri dependencies 2023-10-05 19:28:26 +02:00
bors
ff3e990e42 Auto merge of #3106 - RalfJung:tree-borrows-initial, r=RalfJung
Tree Borrows: do not create new tags as 'Active'

Cc `@Vanille-N`
2023-10-05 07:06:54 +00:00
Ralf Jung
5178ae60a1 Tree Borrows: do not create new tags as 'Active' 2023-10-05 08:18:56 +02:00
bors
6ed502d012 Auto merge of #3000 - RalfJung:no_std, r=oli-obk
auto-detect no_std where possible

r? `@oli-obk`
Cc https://rust-lang.zulipchat.com/#narrow/stream/269128-miri/topic/restricted_std.20sysroot.3F
2023-10-05 06:07:27 +00:00
bors
40c928e946 Auto merge of #3105 - RalfJung:sysroot-target, r=RalfJung
miri-script: print which sysroot target we are building
2023-10-04 20:19:16 +00:00
Ralf Jung
7d065db5c1 miri-script: print which sysroot target we are building 2023-10-04 22:17:15 +02:00
Ralf Jung
31a57557f6 auto-detect no_std where possible 2023-10-04 22:12:26 +02:00
bors
4f73d3fc72 Auto merge of #3102 - eduardosm:typos, r=RalfJung
Fix typos `*ucom` → `ucom*`
2023-10-03 18:02:24 +00:00
Ralf Jung
3e21c1fc56
wording tweaks 2023-10-03 20:00:48 +02:00
Eduardo Sánchez Muñoz
91ef03bf2f Fix typos *ucomucom* 2023-10-03 18:14:01 +02:00
bors
43d10428c8 Auto merge of #3099 - RalfJung:abi-target-feature, r=RalfJung
add test for a function ABI mismatch due to target features

Cc https://github.com/rust-lang/miri/issues/3095
2023-10-02 16:32:57 +00:00
Ralf Jung
cfbcc0e6f5 add test for a function ABI mismatch due to target features 2023-10-02 18:30:03 +02:00
Ralf Jung
6687c075df update lockfile 2023-10-01 07:03:42 +02:00
bors
ea4a98369a Auto merge of #3097 - RalfJung:rustup, r=RalfJung
Rustup
2023-09-30 21:33:44 +00:00
Ralf Jung
119113114c clippy 2023-09-30 23:32:23 +02:00
Ralf Jung
45d5733ccb fmt 2023-09-30 23:30:51 +02:00
Ralf Jung
9a86bba831 Merge from rustc 2023-09-30 23:29:17 +02:00
Ralf Jung
d628338615 Preparing for merge from rustc 2023-09-30 23:29:13 +02:00
bors
a456149187 Auto merge of #3086 - eduardosm:x86-sse3-intrinsics, r=RalfJung
Implement SSE3 and SSSE3 intrinsics
2023-09-30 20:29:22 +00:00
bors
bb6c66be37 Auto merge of #116127 - onur-ozkan:sanity-checks-on-install, r=Mark-Simulacrum
add sanity checks for user write access on `x install`

Resolves #113580
2023-09-30 18:00:23 +00:00
bors
05c622138c Auto merge of #116286 - ouz-a:merge_my_commits, r=Mark-Simulacrum
Add Oğuz Ağcayazı to .mailmap

this will merge my commits under one name (hopefully)
2023-09-30 16:05:49 +00:00
bors
935ced529d Auto merge of #3096 - sthibaul:master, r=RalfJung
Bump libloading to 0.8
2023-09-30 15:33:42 +00:00
Samuel Thibault
97bb8c80ed Bump libloading to 0.8 2023-09-30 15:59:14 +02:00
bors
75d731eee9 Auto merge of #116254 - WaffleLapkin:nicen-traversal, r=cjgillot
Assorted improvements for `rustc_middle::mir::traversal`

r? `@cjgillot`

I'm not _entirely_ sure about all changes, although I do like all of them. If you'd like I can drop some commits. Best reviewed on a commit-by-commit basis, I think, since they are fairly isolated.
2023-09-30 12:38:12 +00:00
ouz-a
1008c98405 Add Oğuz Ağcayazı to .mailmap 2023-09-30 14:16:12 +03:00
Eduardo Sánchez Muñoz
2c13713de4 Implement llvm.x86.ssse3.* intrinsics 2023-09-30 11:30:03 +02:00
Eduardo Sánchez Muñoz
4b2b0eaff2 Implement llvm.x86.sse3.* intrinsics 2023-09-30 11:30:03 +02:00
bors
5282e5e120 Auto merge of #116195 - fmease:rustdoc-investigate-perf-regression, r=GuillaumeGomez
rustdoc: speed up processing of cross-crate fns to fix a perf regression

* The first commit doesn't affect perf but get's rid of a `.clone()` and a bunch of lines of code. I can drop it if you'd like me to
* The second commit, *“reduce the amount of `asyncness` query executions”*, addresses the perf regression introduced in #116084

r? `@ghost`
2023-09-30 09:18:06 +00:00
bors
177091258c Auto merge of #116280 - weihanglo:update-cargo, r=weihanglo
Update cargo

4 commits in e6aabe8b3fcf639be3a5bf68e77853bd7b3fa27d..59596f0f31a94fde48b5aa7e945cd0b7ceca9620
2023-09-26 16:31:53 +0000 to 2023-09-29 19:29:17 +0000
- refactor: Switch from termcolor to anstream (rust-lang/cargo#12751)
- Add missing `strip` entries in `dev` and `release` profiles. (rust-lang/cargo#12748)
- Add better suggestion for the unsupported silent flag (rust-lang/cargo#12723)
- docs(ref): Establish publish best practices (rust-lang/cargo#12745)

r? ghost
2023-09-30 05:53:30 +00:00
bors
9136560d32 Auto merge of #115933 - oli-obk:simd_shuffle_const, r=workingjubilee
Prototype using const generic for simd_shuffle IDX array

cc https://github.com/rust-lang/rust/issues/85229

r? `@workingjubilee` on the design

TLDR: there is now a `fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;` intrinsic that allows replacing

```rust
simd_shuffle(a, b, const { stuff })
```

with

```rust
simd_shuffle_generic::<_, _, {&stuff}>(a, b)
```

which makes the compiler implementations much simpler, if we manage to at some point eliminate `simd_shuffle`.

There are some issues with this today though (can't do math without bubbling it up in the generic arguments). With this change, we can start porting the simple cases and get better data on the others.
2023-09-30 04:05:26 +00:00
bors
4efd65571e Auto merge of #115546 - SUPERCILEX:patch-2, r=Amanieu
Weaken needlessly restrictive orderings on Arc::*_count

Follow up to https://github.com/rust-lang/rust/pull/95183 from this zulip: https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Why.20does.20Arc.3A.3Astrong_count.20use.20Acquire.20instead.20of.20Relaxed.3F/near/386213850

I'd like to use the strong_count for a lockless algorithm I'm writing, but I don't need acquire semantics so that's pointlessly restrictive on arm/risc-v.
2023-09-30 02:15:19 +00:00
Weihang Lo
1ad3bb971b
Update cargo 2023-09-30 09:06:06 +08:00
bors
b8b376a287 Auto merge of #115368 - loongarch-rs:none-tier2, r=pietroalbini
Promote loongarch64-unknown-none* to Tier 2

MCP: https://github.com/rust-lang/compiler-team/issues/664
2023-09-30 00:33:43 +00:00
León Orell Valerian Liehr
841bff2e29
rustdoc: reduce the amount of asyncness query executions 2023-09-30 01:38:02 +02:00