Skip to content

vfork can cause memory corruption due to the lack of #[ffi_returns_twice] #1596

Closed
@Amanieu

Description

@Amanieu

Due to the lack of a stable #[ffi_returns_twice] attribute, vfork cannot be safely used since it can cause memory corruption of unrelated local variables in the parent process.

Miscompilation example: https://play.rust-lang.org/?version=nightly&mode=release&edition=2018&gist=e192ab81e8d408fa9984f766e2356697

Fixed (but nightly-only) version with #[ffi_returns_twice]: https://play.rust-lang.org/?version=nightly&mode=release&edition=2018&gist=0de019e56b69aa048f3e0f5319cc187e

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugI-unsound 💥A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessO-linux

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions