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: detect wrong vtables in wide pointers #124220

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

RalfJung
Copy link
Member

Fixes rust-lang/miri#3497.
Needed to catch the UB that #123572 will start exploiting.

r? @oli-obk

@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 Apr 21, 2024
@rustbot
Copy link
Collaborator

rustbot commented Apr 21, 2024

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

@RalfJung RalfJung force-pushed the interpret-wrong-vtable branch from f3e884a to 120d776 Compare April 21, 2024 10:32
@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung force-pushed the interpret-wrong-vtable branch from 120d776 to 875f0c2 Compare April 21, 2024 11:05
@@ -17,7 +17,7 @@ impl Foo<u32> for u32 { fn foo(&self, _: u32) -> u32 { self+43 } }
impl Bar for () {}

unsafe fn round_trip_and_call<'a>(t: *const (dyn Foo<u32>+'a)) -> u32 {
let foo_e : *const dyn Foo<u16> = t as *const _;
let foo_e : *const dyn Foo<u32> = t as *const _;
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if this intentionally changed the type or if it was intended to only cast away the lifetime. But we probably shouldn't have ui tests with UB. ;)

@oli-obk
Copy link
Contributor

oli-obk commented Apr 22, 2024

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 22, 2024

📌 Commit 875f0c2 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 Apr 22, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 22, 2024
…=oli-obk

Miri: detect wrong vtables in wide pointers

Fixes rust-lang/miri#3497.
Needed to catch the UB that rust-lang#123572 will start exploiting.

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

Rollup of 5 pull requests

Successful merges:

 - rust-lang#104087 (Stabilise inline_const)
 - rust-lang#123792 (Require explicitly marking closures as coroutines)
 - rust-lang#124057 (Fix ICE when ADT tail has type error)
 - rust-lang#124178 ([cleanup] [llvm backend] Prevent creating the same `Instance::mono` multiple times)
 - rust-lang#124220 (Miri: detect wrong vtables in wide pointers)

r? `@ghost`
`@rustbot` modify labels: rollup
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 22, 2024
…=oli-obk

Miri: detect wrong vtables in wide pointers

Fixes rust-lang/miri#3497.
Needed to catch the UB that rust-lang#123572 will start exploiting.

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

Rollup of 5 pull requests

Successful merges:

 - rust-lang#124178 ([cleanup] [llvm backend] Prevent creating the same `Instance::mono` multiple times)
 - rust-lang#124183 (Stop taking `ParamTy`/`ParamConst`/`EarlyParamRegion`/`AliasTy` by ref)
 - rust-lang#124217 (coverage: Prepare for improved branch coverage)
 - rust-lang#124220 (Miri: detect wrong vtables in wide pointers)
 - rust-lang#124252 (Improve ICE message for forbidden dep-graph reads.)

r? `@ghost`
`@rustbot` modify labels: rollup
@GuillaumeGomez
Copy link
Member

I think it detected new memory bugs which need to be fixed before it can be merged (as you can see in #124264 CI output).

@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 Apr 22, 2024
@RalfJung
Copy link
Member Author

That looks to be just another case of #123583.

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Apr 22, 2024

📌 Commit 875f0c2 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 Apr 22, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 23, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#123680 (Deny gen keyword in `edition_2024_compat` lints)
 - rust-lang#124057 (Fix ICE when ADT tail has type error)
 - rust-lang#124168 (Use `DefiningOpaqueTypes::Yes` in rustdoc, where the `InferCtxt` is guaranteed to have no opaque types it can define)
 - rust-lang#124197 (Move duplicated code in functions in `tests/rustdoc-gui/notable-trait.goml`)
 - rust-lang#124200 (Improve handling of expr->field errors)
 - rust-lang#124220 (Miri: detect wrong vtables in wide pointers)
 - rust-lang#124266 (remove an unused type from the reentrant lock tests)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8039488 into rust-lang:master Apr 23, 2024
12 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 23, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 23, 2024
Rollup merge of rust-lang#124220 - RalfJung:interpret-wrong-vtable, r=oli-obk

Miri: detect wrong vtables in wide pointers

Fixes rust-lang/miri#3497.
Needed to catch the UB that rust-lang#123572 will start exploiting.

r? `@oli-obk`
@RalfJung RalfJung deleted the interpret-wrong-vtable branch April 23, 2024 09:51
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.

Wide pointer metadata validity: check that the vtable is for the right trait
6 participants