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

OwningRef is included in the compiler despite known soundness problems. #109974

Closed
noamtashma opened this issue Apr 5, 2023 · 1 comment · Fixed by #109971
Closed

OwningRef is included in the compiler despite known soundness problems. #109974

noamtashma opened this issue Apr 5, 2023 · 1 comment · Fixed by #109971
Assignees
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@noamtashma
Copy link
Contributor

The OwningRef module in rustc_data_structures, which seems to be a copy of this crate (perhaps with small additions?), has known soundness issues.

I wrote an article about the soundness problems here.

It's used in rustc in MetadataRef and related things. (I don't know if it's used anywhere else).

I don't know of any actual unsafe use of this crate in rustc, but I haven't actually tried to look for any.

IMO, in order to keep the code safe, either owning_ref should be replaced with something else, or otherwise, it should be updated to contain the known fixes to these soundness problems (here).

@Noratrieb
Copy link
Member

Great timing! #109971

@Noratrieb Noratrieb changed the title [T-compiler] OwningRef is included in the compiler despite known soundness problems. OwningRef is included in the compiler despite known soundness problems. Apr 5, 2023
@Noratrieb Noratrieb added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 5, 2023
@Noratrieb Noratrieb added the C-discussion Category: Discussion or questions that doesn't represent real issues. label Apr 5, 2023
Noratrieb added a commit to Noratrieb/rust that referenced this issue Apr 7, 2023
…strieb

Yeet `owning_ref`

Based on the discussions from rust-lang#109948

This replaces `owning_ref` with a far simpler & safer abstraction.

Fixes rust-lang#109974
Noratrieb added a commit to Noratrieb/rust that referenced this issue Apr 7, 2023
…strieb

Yeet `owning_ref`

Based on the discussions from rust-lang#109948

This replaces `owning_ref` with a far simpler & safer abstraction.

Fixes rust-lang#109974
@bors bors closed this as completed in 0f0dc29 Apr 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants