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

CTFE/Miri: detect out-of-bounds pointers in offset_from #94827

Merged
merged 1 commit into from
Mar 12, 2022

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Mar 10, 2022

Also I became uneasy with aggressively doing try_to_int here -- this will always succeed on Miri, leading to the wrong codepath being taken. We should rather try to convert them both to pointers, and use the integer path as a fallback, so that's what I implemented now.

Hiding whitespaces helps with the diff.

Fixes rust-lang/miri#1950

r? @oli-obk

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 10, 2022
@rust-highfive
Copy link
Collaborator

Some changes occured to the CTFE / Miri engine

cc @rust-lang/miri

Some changes occured to the CTFE / Miri engine

cc @rust-lang/miri

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 10, 2022
@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor

oli-obk commented Mar 11, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Mar 11, 2022

📌 Commit 63ed8e4 has been approved by oli-obk

@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, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Mar 11, 2022
CTFE/Miri: detect out-of-bounds pointers in offset_from

Also I became uneasy with aggressively doing `try_to_int` here -- this will always succeed on Miri, leading to the wrong codepath being taken. We should rather try to convert them both to pointers, and use the integer path as a fallback, so that's what I implemented now.

Hiding whitespaces helps with the diff.

Fixes rust-lang/miri#1950

r? `@oli-obk`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 11, 2022
Rollup of 7 pull requests

Successful merges:

 - rust-lang#87618 (Add missing documentation for std::char types)
 - rust-lang#94769 (Collapse blanket and auto-trait impls by default)
 - rust-lang#94798 (`parse_tt` refactorings)
 - rust-lang#94818 (Rename `IntoFuture::Future` to `IntoFuture::IntoFuture`)
 - rust-lang#94827 (CTFE/Miri: detect out-of-bounds pointers in offset_from)
 - rust-lang#94838 (Make float parsing docs more comprehensive)
 - rust-lang#94839 (Suggest using double colon when a struct field type include single colon)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9e70b1a into rust-lang:master Mar 12, 2022
@rustbot rustbot added this to the 1.61.0 milestone Mar 12, 2022
@RalfJung RalfJung deleted the offset-from-ub branch March 12, 2022 02:53
bors added a commit to rust-lang/miri that referenced this pull request Mar 12, 2022
add ptr_offset_from OOB test, and update test errors

The Miri side of rust-lang/rust#94827.
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.

Miri does not check all offset_from conditions
6 participants