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

syscall! macros hide unsafe code #1753

Open
djkoloski opened this issue Jan 10, 2024 · 2 comments
Open

syscall! macros hide unsafe code #1753

djkoloski opened this issue Jan 10, 2024 · 2 comments

Comments

@djkoloski
Copy link

djkoloski commented Jan 10, 2024

While auditing mio for Fuchsia, I usually grep for unsafe and audit the unsafe blocks. However, the syscall! macros for unix and windows include their own unsafe { .. } blocks wrapping the underlying unsafe functions. This makes it harder to ensure that every syscall is properly justified. Removing the unsafe blocks from the macro would help solve this problem; whoever uses the macro would need to wrap it in unsafe { .. } and provide a safety comment at the usage site.

@Thomasdezeeuw
Copy link
Collaborator

System calls are inherintly unsafe, I don't think add unsafe blocks and comments everywhere is going to help. Furthermore there are plenty for system calls that aren't really unsafe. For example socket(2), it can't do any dangerous. Of course things like read(2) and write(2) can cause you read/write arbitrary memory, but most of those calls we delegated to std lib.

@Thomasdezeeuw
Copy link
Collaborator

Closing because I don't think we need to do anything further here.

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

2 participants