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 sure any pointer being passed to RustPOSIX is 8-byte aligned #327

Open
rennergade opened this issue Oct 15, 2023 · 2 comments
Open
Assignees
Labels
good first issue Good for newcomers

Comments

@rennergade
Copy link
Contributor

We're updating our rust compiler version when we merge the domain socket branch. This fortunately/unfortunately revealed a bug where it was possible to convert pointers that arent 8-byte aligned that rust just let slide before this version (even though thats technically undefined behavior).

@RusherRG found this bug with the updated compiler when testing bind"

thread '<unnamed>' panicked at 'misaligned pointer dereference: address must be a multiple of 0x8 but is 0x64c810067d1c', src/interface/types.rs:435:61

This has the effect of giving a venue to force a trusted fault from user code. We should check all pointer alignment in NaCl before we call to RustPOSIX, and if theyre not aligned return an error.

@rennergade rennergade added the good first issue Good for newcomers label Jan 11, 2024
@rennergade
Copy link
Contributor Author

We should be able to do this easily in our pointer conversion functions since we use them for all pointer translation. Let's do a check in NaClUserToSysAddrRangeProt and NaClUserToSysAddrProt for 8-bit alignment and if not return an error.

@rennergade
Copy link
Contributor Author

We'll need to run all tests for this to make sure it doesn't break anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants