-
Notifications
You must be signed in to change notification settings - Fork 147
stack zeroization #1215
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
base: master
Are you sure you want to change the base?
stack zeroization #1215
Conversation
I think it might be better if something like this started out as its own experimental crate, especially as |
What should the crate be called? |
Regarding the rest, spike it out however you'd like, but the difficult part will be the rationale for why it's sound. |
I can go with With |
Yeah, I've seen Interesting prototype of the idea. |
Does it pass Miri? I left some ideas in the original issue. |
Darn. Miri wants me to use the following syntax due to how the psm::psm_stack_manipulation! {
yes {
/// define fn with psm::on_stack
pub unsafe fn blah(...) {...}
}
no {
/// define fn without psm::on_stack, likely panic
pub unsafe fn blah(...) { panic!("Stack manipulation not available on this platform")}
}
} After defining it like this, miri fails with the message "Stack manipulation not available on this platform". Likely because miri doesn't have a stack pointer or something... given that this crate was tied to the rust-lang account, I'd say their code is probably legit, and I'm not sure if Miri would be able to analyze all of the assembly without manually using different targets |
You can confirm that the test passes normally using |
Further evidence for miri not working can be found in https://github.com/rust-lang/stacker/blob/7a3ff32d72bcd0a12a938abb21deddf9f1449cdc/psm/build.rs#L66 |
… comment to debugging section; make no-panic feature for no branch of psm macro? handle closure panic with match?
… with futures::executor::block_on(f()), add asm alternative(?), handle unwind better(?), use stacker crate to handle stack size management(?) or at least use their code(?)
Uses
psm
to run a function/closure on a stack that is allocated on the heap, then zeroizes that separate stack when the execution finishes.I attempted to zeroize the space between two pointers: one captured before the closure's call and one after, but upon zeroing the stack, there was a segmentation fault. I will have to remove that code, but it's there in the first commit if anyone thinks they can get it to run without a segmentation fault.
Closes #810 if this is up to standards.