3 ms·
Doesn't Rust do all its type checking at compile time, not run-time? (Not to say that a correctly-written Rust program wouldn't be vulnerable to Spectre for ot
by rcthompson 9y ago
Doesn't Rust do all its type checking at compile time, not run-time?
(Not to say that a correctly-written Rust program wouldn't be vulnerable to Spectre for other reasons, of course.)
- pizlonator 9y agoRust has algebraic types, so Spectre could be used to train the branch predictor to take one type case of your match statement, and then have that case taken when the enum is actually in a different shape. That's a violation of the type system.
- FreeFull 9y agoIf I'm reading this correctly, the issue isn't with the types of the language you wrote the Javascript engine in, but with Javascript's types. All major Javascript engines are written in C++, which also does all its type checking at compile-time.
- pizlonator 9y agoNot quite. Our C++ code often does static_cast<> as a downcast based on testing some condition. That's a run-time type check. This isn't solely about those type checks that were implemented using some built-into-the-language type checking mechanism. Also, C++ does have a dynamic type check primitive (dynamic_cast). We are mitigating these branch-based type checks with pointer poisoning, and I don't think that those changes are biased in favor of C++ or JS, since both are vulnerable.
- rcthompson 9y agoAh yes, that makes sense.