Skip to content

Miri subtree update #129785

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

Merged
merged 55 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
4abdcd7
provenance_gc: fix comment
RalfJung Aug 19, 2024
4001f59
make the cleanup functions private
RalfJung Aug 19, 2024
e698ca1
fix a misleading comment in TB tests
sun-jacobi Aug 22, 2024
3a423fc
Avoid extra copy by using `retain_mut` and moving the deletion into t…
JoJoDeveloping Aug 22, 2024
e881c42
Auto merge of #3834 - sun-jacobi:tb-comment, r=RalfJung
bors Aug 22, 2024
b8c02eb
Auto merge of #3835 - JoJoDeveloping:tb-fix-stack-overflow, r=RalfJung
bors Aug 22, 2024
7f968ba
fix calling pipe, pipe2, socketpair with a pointer-to-array
RalfJung Aug 24, 2024
17659eb
Auto merge of #3840 - RalfJung:pipe-to-array, r=RalfJung
bors Aug 24, 2024
14f22c6
epoll: Add EINVAL case
tiif Aug 23, 2024
3a9e63c
Auto merge of #3836 - tiif:einval_ctl, r=oli-obk
bors Aug 24, 2024
23f308b
Handle edge case for epoll_ctl
tiif Aug 20, 2024
dbfd066
Auto merge of #3829 - tiif:edgecase, r=oli-obk
bors Aug 24, 2024
f71cdbb
Support blocking for epoll
tiif Aug 19, 2024
e8175a4
Improve comment
tiif Aug 24, 2024
41ab4ec
Pass dest place reference to epoll_wait
tiif Aug 24, 2024
36235b9
Rename event to events
tiif Aug 24, 2024
cd67e47
Fix error in the timeout value error message
tiif Aug 24, 2024
8f178e4
Change timeout value
tiif Aug 24, 2024
7aff711
Check if the thread is blocked before waking them up
tiif Aug 24, 2024
a4d7564
Fix error introduced by rebase
tiif Aug 24, 2024
7e8ca57
Remove thread_id from epoll::thread_ids after timeout
tiif Aug 24, 2024
25ca855
Make blocking_epoll_callback a private function
tiif Aug 24, 2024
7d5be06
Add 0 preemption rate flag for blocking test and fix comment
tiif Aug 24, 2024
09993ce
Add 0 preemption rate flag
tiif Aug 24, 2024
0ed13eb
Add test for triggering notification after timeout
tiif Aug 25, 2024
e01bc04
Preparing for merge from rustc
Aug 26, 2024
55fba66
Merge from rustc
Aug 26, 2024
9fb611c
silence an overreaching clippy lint
RalfJung Aug 26, 2024
2f13379
Auto merge of #3844 - rust-lang:rustup-2024-08-26, r=RalfJung
bors Aug 26, 2024
25e5ac4
Disable tree traversal optimization that is wrong due to lazy nodes.
JoJoDeveloping Aug 26, 2024
eb7bf6e
Auto merge of #3827 - RalfJung:gc-comment, r=RalfJung
bors Aug 27, 2024
6f8fb3c
tree_borrows test: ensure we can actually read the variable
RalfJung Aug 27, 2024
9f35309
Auto merge of #3849 - RalfJung:tb-test, r=RalfJung
bors Aug 27, 2024
664640f
Add testcase for #3846
JoJoDeveloping Aug 27, 2024
9b82f3b
Auto merge of #3847 - JoJoDeveloping:master, r=RalfJung
bors Aug 27, 2024
2765444
Make TB tree traversal bottom-up
JoJoDeveloping Aug 25, 2024
5be5cec
Add explanation to TB's "piecewise bottom-up" traversal
JoJoDeveloping Aug 27, 2024
4318bfe
Auto merge of #3843 - JoJoDeveloping:tb-bottom-up-iteration, r=RalfJung
bors Aug 27, 2024
e26779e
Make Tree Borrows Provenance GC compact the tree
JoJoDeveloping Aug 23, 2024
2d69baa
Auto merge of #3804 - tiif:blockit, r=oli-obk
bors Aug 27, 2024
ae3c270
Preparing for merge from rustc
Aug 28, 2024
f4f3447
Merge from rustc
Aug 28, 2024
3a655aa
Auto merge of #3850 - rust-lang:rustup-2024-08-28, r=RalfJung
bors Aug 28, 2024
abcfc17
Add test for tokio file io and mpsc
tiif Aug 27, 2024
79115f5
Auto merge of #3848 - tiif:tokiotest, r=RalfJung
bors Aug 28, 2024
e34f35e
Add benchmark for TB slowdown
JoJoDeveloping Aug 27, 2024
84134c6
address nits
JoJoDeveloping Aug 28, 2024
9ad0f65
Auto merge of #3837 - JoJoDeveloping:tb-compacting-provenance-gc, r=R…
bors Aug 28, 2024
b0c3324
Preparing for merge from rustc
Aug 29, 2024
a10633a
Merge from rustc
Aug 29, 2024
b5be3ab
fix wasm test
RalfJung Aug 29, 2024
ad7a1aa
Auto merge of #3851 - rust-lang:rustup-2024-08-29, r=RalfJung
bors Aug 29, 2024
0453d9b
Preparing for merge from rustc
Aug 30, 2024
23f4eae
Merge from rustc
Aug 30, 2024
f03c7b2
Auto merge of #3853 - rust-lang:rustup-2024-08-30, r=saethlin
bors Aug 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/tools/miri/bench-cargo-miri/slice-chunked/Cargo.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3

[[package]]
name = "slice-chunked"
version = "0.1.0"
8 changes: 8 additions & 0 deletions src/tools/miri/bench-cargo-miri/slice-chunked/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "slice-chunked"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
26 changes: 26 additions & 0 deletions src/tools/miri/bench-cargo-miri/slice-chunked/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//! This is a small example using slice::chunks, which creates a very large Tree Borrows tree.
//! Thanks to ##3837, the GC now compacts the tree, so this test can be run in a reasonable time again.
//! The actual code is adapted from tiny_skia, see https://github.com/RazrFalcon/tiny-skia/blob/master/src/pixmap.rs#L121
//! To make this benchmark demonstrate the effectiveness, run with MIRIFLAGS="-Zmiri-tree-borrows -Zmiri-provenance-gc=100"
const N: usize = 1000;

fn input_vec() -> Vec<u8> {
vec![0; N]
}

fn main() {
let data_len = 2 * N;
let mut rgba_data = Vec::with_capacity(data_len);
let img_data = input_vec();
for slice in img_data.chunks(2) {
let gray = slice[0];
let alpha = slice[1];
rgba_data.push(gray);
rgba_data.push(gray);
rgba_data.push(gray);
rgba_data.push(alpha);
}

assert_eq!(rgba_data.len(), data_len);
}
2 changes: 1 addition & 1 deletion src/tools/miri/rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fdf61d499c8a8421ecf98e7924bb87caf43a9938
0d634185dfddefe09047881175f35c65d68dcff1
6 changes: 6 additions & 0 deletions src/tools/miri/src/borrow_tracker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ pub struct FrameState {

impl VisitProvenance for FrameState {
fn visit_provenance(&self, visit: &mut VisitWith<'_>) {
// Visit all protected tags. At least in Tree Borrows,
// protected tags can not be GC'd because they still have
// an access coming when the protector ends. Additionally,
// the tree compacting mechanism of TB's GC relies on the fact
// that all protected tags are marked as live for correctness,
// so we _have_ to visit them here.
for (id, tag) in &self.protected_tags {
visit(Some(*id), Some(*tag));
}
Expand Down
40 changes: 39 additions & 1 deletion src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ mod transition {
Active =>
if protected {
// We wrote, someone else reads -- that's bad.
// (If this is initialized, this move-to-protected will mean insta-UB.)
// (Since Active is always initialized, this move-to-protected will mean insta-UB.)
Disabled
} else {
// We don't want to disable here to allow read-read reordering: it is crucial
Expand Down Expand Up @@ -267,6 +267,44 @@ impl Permission {
transition::perform_access(kind, rel_pos, old_state, protected)
.map(|new_state| PermTransition { from: old_state, to: new_state })
}

/// During a provenance GC, we want to compact the tree.
/// For this, we want to merge nodes upwards if they have a singleton parent.
/// But we need to be careful: If the parent is Frozen, and the child is Reserved,
/// we can not do such a merge. In general, such a merge is possible if the parent
/// allows similar accesses, and in particular if the parent never causes UB on its
/// own. This is enforced by a test, namely `tree_compacting_is_sound`. See that
/// test for more information.
/// This method is only sound if the parent is not protected. We never attempt to
/// remove protected parents.
pub fn can_be_replaced_by_child(self, child: Self) -> bool {
match (self.inner, child.inner) {
// ReservedIM can be replaced by anything, as it allows all
// transitions.
(ReservedIM, _) => true,
// Reserved (as parent, where conflictedness does not matter)
// can be replaced by all but ReservedIM,
// since ReservedIM alone would survive foreign writes
(ReservedFrz { .. }, ReservedIM) => false,
(ReservedFrz { .. }, _) => true,
// Active can not be replaced by something surviving
// foreign reads and then remaining writable.
(Active, ReservedIM) => false,
(Active, ReservedFrz { .. }) => false,
// Replacing a state by itself is always okay, even if the child state is protected.
(Active, Active) => true,
// Active can be replaced by Frozen, since it is not protected.
(Active, Frozen) => true,
(Active, Disabled) => true,
// Frozen can only be replaced by Disabled (and itself).
(Frozen, Frozen) => true,
(Frozen, Disabled) => true,
(Frozen, _) => false,
// Disabled can not be replaced by anything else.
(Disabled, Disabled) => true,
(Disabled, _) => false,
}
}
}

impl PermTransition {
Expand Down
Loading
Loading