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

interpret: do not call machine read hooks during validation #122249

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Mar 9, 2024

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 9, 2024
@rustbot
Copy link
Collaborator

rustbot commented Mar 9, 2024

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

The Miri subtree was changed

cc @rust-lang/miri

@RalfJung RalfJung force-pushed the machine-read-hook branch from f72a115 to c003fa5 Compare March 9, 2024 18:15
// Temporarily allow access to the static_root_alloc_id for the purpose of validation.
let static_root_alloc_id = ecx.machine.static_root_alloc_id.take();
let validation = const_validate_mplace(&ecx, &mplace, cid);
ecx.machine.static_root_alloc_id = static_root_alloc_id;
Copy link
Member Author

Choose a reason for hiding this comment

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

I am a bit torn about whether before_alloc_read should be suppressed during validation. OTOH it is nice that we can now remove this code here. On the other hand, now if validation does do a read from this static, it will see Uninit and show a surprising error rather than triggering a cycle error. I don't know if it is even possible to do that, it would require a copy_op_transmute from the static to somewhere else.

If validation passes, we'll still get the cycle error from the actual read part of copy_op.

@@ -0,0 +1,28 @@
#![feature(start)]
#![no_std]
//@compile-flags: -Zmiri-track-alloc-id=17 -Zmiri-track-alloc-accesses -Cpanic=abort
Copy link
Member Author

Choose a reason for hiding this comment

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

As an isolated no_std test, I think the alloc IDs here should be fully stable.

Copy link
Member Author

Choose a reason for hiding this comment

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

Damn, somehow it is different on macOS... I guess I'll have to add some only-target.

@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung force-pushed the machine-read-hook branch from c003fa5 to bf47df8 Compare March 9, 2024 19:00
@oli-obk

This comment was marked as resolved.

@RalfJung

This comment was marked as resolved.

@oli-obk

This comment was marked as resolved.

@oli-obk oli-obk force-pushed the machine-read-hook branch from 3c4f73d to bf47df8 Compare March 11, 2024 15:30
@oli-obk
Copy link
Contributor

oli-obk commented Mar 11, 2024

@bors r+

I can explore my ideas in separate PRs

@bors
Copy link
Contributor

bors commented Mar 11, 2024

📌 Commit bf47df8 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-review Status: Awaiting review from the assignee but also interested parties. labels Mar 11, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 11, 2024
interpret: do not call machine read hooks during validation

Fixes rust-lang/miri#3347

r? `@oli-obk`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 11, 2024
…kingjubilee

Rollup of 15 pull requests

Successful merges:

 - rust-lang#116791 (Allow codegen backends to opt-out of parallel codegen)
 - rust-lang#116793 (Allow targets to override default codegen backend)
 - rust-lang#117458 (LLVM Bitcode Linker: A self contained linker for nvptx and other targets)
 - rust-lang#119385 (Fix type resolution of associated const equality bounds (take 2))
 - rust-lang#121438 (std support for wasm32 panic=unwind)
 - rust-lang#121893 (Add tests (and a bit of cleanup) for interior mut handling in promotion and const-checking)
 - rust-lang#122080 (Clarity improvements to `DropTree`)
 - rust-lang#122152 (Improve diagnostics for parenthesized type arguments)
 - rust-lang#122166 (Remove the unused `field_remapping` field from `TypeLowering`)
 - rust-lang#122249 (interpret: do not call machine read hooks during validation)
 - rust-lang#122299 (Store backtrace for `must_produce_diag`)
 - rust-lang#122318 (Revision-related tweaks for next-solver tests)
 - rust-lang#122320 (Use ptradd for vtable indexing)
 - rust-lang#122328 (unix_sigpipe: Replace `inherit` with `sig_dfl` in syntax tests)
 - rust-lang#122330 (bootstrap readme: fix, improve, update)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f6ca425 into rust-lang:master Mar 11, 2024
22 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Mar 11, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 11, 2024
Rollup merge of rust-lang#122249 - RalfJung:machine-read-hook, r=oli-obk

interpret: do not call machine read hooks during validation

Fixes rust-lang/miri#3347

r? ``@oli-obk``
@RalfJung RalfJung deleted the machine-read-hook branch March 11, 2024 20:52
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alloc access tracking shows spurious reads after each write
5 participants