-
Notifications
You must be signed in to change notification settings - Fork 5
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
Allocator wrapper implementation contains undefined behavior #37
Comments
Thanks for digging into this @complexspaces. We always appreciate outside reviews on these things. If I understand the concerns around slice::from_raw_parts it's that we're violating the following safety criteria.
Since the padding would be uninitialized? Looking at the 1password implementation, it uses Yes the tests are full of UB, I've been meaning to get back and improving them but haven't had the time. Looking at old GH actions runs it seems Ubuntu 22.04 failed, but from what I recall we also ran them on local devices where I believe they did succeed. |
Yep, that's correct.
Correct as well 👍. Raw pointers do not have the same initialization/validity requirements that references do, so you can use them to write values to a place with generally less rules. Our implementation is doing something similar to |
Hey there,
While looking at Bitwarden's implementation of zeroizing dealloc, I noticed that there is some undefined behavior present:
MaybeUninit<u8>
tou8
unsoundly. Rust is clear that integers may uninitialized.GlobalAlloc
that keeps track of all allocations and can provide a sound API to check if "freed" memory was wiped with zeroes.We (1Password) made a similar crate wrapper last year for our Core, and we just open sourced it today if you'd like to use it directly or as a reference to improve on this: https://github.com/1Password/zeroizing-alloc
The text was updated successfully, but these errors were encountered: