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

Audit all cmsg code #1013

Closed
asomers opened this issue Jan 14, 2019 · 2 comments · Fixed by #1020
Closed

Audit all cmsg code #1013

asomers opened this issue Jan 14, 2019 · 2 comments · Fixed by #1020

Comments

@asomers
Copy link
Member

asomers commented Jan 14, 2019

control messages used by sendmsg and recvmsg are one of the hardest Unix APIs. Some of Nix's cmsg-related tests currently fail on OpenBSD (see #1001), and others rely on a hard-coded os-dependent value that is not defined anywhere in libc (align_of_cmsg_data). Both of these things hint at underlying bugs in our cmsg implementation. We should audit the entire thing for correctness, and possibly rewrite it to be more C-like. libc already exports versions of the CMSG_DATA family of macros. Nix should use those rather than reinvent their logic.

@asomers
Copy link
Member Author

asomers commented Jan 14, 2019

Blocked by rust-lang/libc#1210

@asomers
Copy link
Member Author

asomers commented Jan 15, 2019

Ok, I've got this working now. It passes the tests on FreeBSD, OpenBSD, and NetBSD. But now the scm_credentials tests fail on Linux. I suppose I'll keep working on it.

bors bot added a commit that referenced this issue Feb 14, 2019
1020: Major cmsg cleanup r=asomers a=asomers

This PR fixes multiple bugs in the cmsg code.
Fixes #994 
Fixes #999 
Fixes #1013 

Co-authored-by: Alan Somers <asomers@gmail.com>
@bors bors bot closed this as completed in #1020 Feb 14, 2019
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 a pull request may close this issue.

1 participant