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

Make clone unsafe #1993

Merged
merged 2 commits into from
Aug 27, 2023
Merged

Make clone unsafe #1993

merged 2 commits into from
Aug 27, 2023

Conversation

djkoloski
Copy link
Contributor

There are many features of clone that may cause memory unsafety when called. This documents one of them and references fork(), which is already unsafe to call.

Fixes #1975

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um yes, clone is nearly impossible to use safely. I see that the clone binding has been present in Nix since its very first commit in 2014, back before Rust 1.0. I'm guessing that almost no one has used it since then, which is why nobody has made it unsafe yet. There's only one problem with this PR: could you add a CHANGELOG entry?

@djkoloski
Copy link
Contributor Author

Sorry for the delay, should be good to go now.

@djkoloski djkoloski requested a review from asomers March 6, 2023 18:53
djkoloski and others added 2 commits August 27, 2023 15:08
There are many features of `clone` that may cause memory unsafety when
called. This documents one of them and references `fork()`, which is
already unsafe to call.
@asomers
Copy link
Member

asomers commented Aug 27, 2023

Sorry I missed this PR when last you updated it. I've just hijacked it to fix the merge conflict.

@asomers asomers added this pull request to the merge queue Aug 27, 2023
Merged via the queue into nix-rust:master with commit 56e1277 Aug 27, 2023
35 checks passed
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

Successfully merging this pull request may close these issues.

sched::clone is unsound and should be unsafe to call
2 participants