ANSSI-FR / rust-guide

Recommendations for secure applications development with Rust
https://anssi-fr.github.io/rust-guide
Other
590 stars 47 forks source link

Should secure Rust programs protect pointers to FFI? #30

Open polazarus opened 4 years ago

polazarus commented 4 years ago

After PR #29 and following up discussions:

For the how, see @danielhenrymantilla's example in https://github.com/ANSSI-FR/rust-guide/pull/29#issuecomment-580269957

polazarus commented 4 years ago

IMO, for some particularly critical (paranoid?) software, it makes sense to protect pointers transmitted to a foreign language. Is it in the scope of this guide? as a rule, I don't think so... it's not pragmatic enough.

With respect to the stack/heap divide, it is still sensible today to consider stack pointers more dangerous. Again, not always possible for various reason.

For the how, it really depends on what you're trying to protect:

In the former, without OS support, canary seems the way to go. In the latter, signed pointers (or tagged pointers) makes more sense.