Fix pointer provenance in <[T]>::copy_within by SkiFire13 · Pull Request #85610 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation3 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

SkiFire13

Previously the self.as_mut_ptr() invalidated the pointer created by the first self.as_ptr(). This also triggered miri when run with -Zmiri-track-raw-pointers

@rust-highfive

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@SkiFire13

@oli-obk

@bors

📌 Commit d7341f3 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

May 25, 2021

JohnTitor added a commit to JohnTitor/rust that referenced this pull request

May 25, 2021

@JohnTitor

…e, r=oli-obk

Fix pointer provenance in <[T]>::copy_within

Previously the self.as_mut_ptr() invalidated the pointer created by the first self.as_ptr(). This also triggered miri when run with -Zmiri-track-raw-pointers

JohnTitor added a commit to JohnTitor/rust that referenced this pull request

May 26, 2021

@JohnTitor

…e, r=oli-obk

Fix pointer provenance in <[T]>::copy_within

Previously the self.as_mut_ptr() invalidated the pointer created by the first self.as_ptr(). This also triggered miri when run with -Zmiri-track-raw-pointers

bors added a commit to rust-lang-ci/rust that referenced this pull request

May 26, 2021

@bors

@SkiFire13 SkiFire13 deleted the fix-copy-within-provenance branch

May 26, 2021 10:39

bors added a commit to rust-lang/miri that referenced this pull request

Jun 3, 2021

@bors

regression tests for pointer invalidation in core library slice methods

A fix for a pointer invalidation bug in <[T]>::copy_within has landed on the Rust master branch. This PR updates the rust-version file to the latest master commit hash and adds extra tests to the Miri test suite to ensure that regressions of this type of bug can be detected for various slice methods with the -Zmiri-track-raw-pointers flag.

I took the liberty of adding 2 extra #![feature] attributes at the top of slices.rs, since there already was one unstable feature. I hope this is okay 😄

One thing I noticed when running the entire Miri test suite with MIRIFLAGS="-Zmiri-track-raw-pointers" ./miri test is that there are currently failing tests on the master branch:

failures:
    [ui] run-pass/align.rs
    [ui] run-pass/box.rs
    [ui] run-pass/concurrency/simple.rs
    [ui] run-pass/libc.rs
    [ui] run-pass/ptr_int_casts.rs
    [ui] run-pass/stacked-borrows/int-to-ptr.rs

test result: FAILED. 199 passed; 6 failed; 1 ignored; 0 measured; 0 filtered out; finished in 12.95s

These failures were not fixed in this PR and already existed prior to this PR. I haven't investigated these yet, but am interested in helping out if possible!

Thanks!

Labels

S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.