Re:What Spectre and Meltdown Mean for WebKit
by FreeFull on Tuesday January 09, 2018 @12:50AM
(#16103923)
If 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.
Re:What Spectre and Meltdown Mean for WebKit
by pizlonator on Tuesday January 09, 2018 @01:08AM
(#16103981)
Not 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.
Re:What Spectre and Meltdown Mean for WebKit
by rcthompson on Tuesday January 09, 2018 @01:02AM
(#16103965)
Ah yes, that makes sense.
Re:What Spectre and Meltdown Mean for WebKit
by pizlonator on Tuesday January 09, 2018 @01:04AM
(#16103974)
Rust 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.
(Not to say that a correctly-written Rust program wouldn't be vulnerable to Spectre for other reasons, of course.)