-
Notifications
You must be signed in to change notification settings - Fork 24
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
Why is unlock
safe?
#15
Comments
The unlock function uses As you surely know, Rust itself has a very clear definition of memory safety; it prevents data races & segmentation faults (i.e. accessing memory that is not owned by the executing code). The It may not be safe in the general sense (e.g. causing a password/token to be paged to disk), but that is not translatable to Rust's semantics of safe (which Finally, both If I'm missing something, or have any misconception regarding the semantics, please feel free to correct me, but from my understanding this is compliant with Rust's rules of memory safety. |
It's tricky.. As I understand it, there is only a locked bit per page that acts like a A priori, I'd expect In practice, I suspect you typically only have limited secret material known when processes start so you |
@darfink Thanks! I can see how your explanation makes sense. I think it's a tricky question though, because the entire point of locking memory is to avoid letting some critical data be swapped out, and having functions like One way to think about it would be to say that the OS swapping pages out of memory constitutes a form of I/O. That's how someone storing sensitive data in memory and using |
I was reviewing the changes between versions 2 and 3 and noticed that the
unlock
function was changed fromunsafe
to safe:02a1d48
Since it operates on a raw pointer, and potentially unlocks memory that it doesn't own (in the Rust ownership sense), should it still be
unsafe
?The text was updated successfully, but these errors were encountered: