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

Assert validity on the raw socket in SockRef::from #253

Merged

Conversation

Thomasdezeeuw
Copy link
Collaborator

Since we now use the niche feature on Unix it's unsound to use
SockRef::from(-1), but it can be done without any unsafe. This change
adds an assertion to ensure we hit this soundness issue.

Still need to wait on the I/O safety RFC:
https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md
Tracking issue: rust-lang/rust#87074
Implementation pr: rust-lang/rust#87329

Closes #229 (again)
Updates #218
Closes #244

Since we now use the niche feature on Unix it's unsound to use
SockRef::from(-1), but it can be done without any unsafe. This change
adds an assertion to ensure we hit this soundness issue.

Still need to wait on the I/O safety RFC:
https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md
Tracking issue: rust-lang/rust#87074
Implementation pr: rust-lang/rust#87329
Doesn't work on 1.46, the AsRawFd implementation for RawFd was
added in Rust 1.48.
@Thomasdezeeuw Thomasdezeeuw force-pushed the 244_sockref_from_unsound branch from 06b7fe5 to bccd366 Compare July 28, 2021 16:51
@Thomasdezeeuw Thomasdezeeuw merged commit b65a640 into rust-lang:master Jul 28, 2021
@Thomasdezeeuw Thomasdezeeuw deleted the 244_sockref_from_unsound branch July 28, 2021 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant