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

Soundness issues in crates for self-referential structs #1709

Open
Shnatsel opened this issue Jun 12, 2023 · 3 comments
Open

Soundness issues in crates for self-referential structs #1709

Shnatsel opened this issue Jun 12, 2023 · 3 comments

Comments

@Shnatsel
Copy link
Member

Most crates that allow self-referential structs are unsound. See Voultapher/self_cell#41 for a list of crates and issues.

We have advisories for Ourouboros (RUSTSEC-2023-0042) and owning-ref (https://rustsec.org/advisories/RUSTSEC-2022-0040.html), we should cover the remaining crates with advisories as well.

@tarcieri
Copy link
Member

@Manishearth hopefully yoke isn't impacted?

@Manishearth
Copy link
Contributor

Manishearth commented Jun 12, 2023

AIUI no. yoke does have potential unsoundness based on some yet-to-be-figured-out opsem rules (and can be fixed with yet-to-be-figured-out APIs). I'm mostly planning on waiting that out, it's tracked in unicode-org/icu4x#2095. There is a way for us to avoid that potential unsoundness today; but that would require giving up an API that I would rather not do yet. Furthermore that potential unsoundness is only present for certain kinds of uses of Yoke.

In general yoke exposes a more limited form of self-reference and is not as susceptible to the issues found in general self-ref crates.

Personally because these rules are still in flux I do not consider "fails miri" to in and of itself be an indication of unsoundness, fwiw. I expect that when the time comes to actually start exploiting the UB surface provided by stacked borrows1; the opsem group will have also provided sufficient APIs to do things like this in ways they can guarantee are sound.

That said, yoke does not currently trip miri anyway.

cc @CAD97

Footnotes

  1. Though it's likely stacked borrows itself is going away and being replaced by tree borrows; which is an example of what I mean by these things still being in flux!

@SoniEx2
Copy link

SoniEx2 commented Jul 20, 2023

is it correct to say selfref is not affected by this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants