Earlier quoted context omitted.
It's common for C++ code to do type checking dynamically. In WebKit we do this by rolling the type checks ourselves. With RTTI, you can do dynamic type checks using the build-in dynamic_cast primitive. Our changes, particularly the ones having to do with pointer poisoning, are meant to protect C++ code that does dynamic type checks in addition to JIT'd JS code that does dynamic type checks. Rust's `match` statement i…
Serious question, is it even possible to have something like ‘match’ or ‘dynamic_cast’ in a programming language without using branches under the hood? I’m not talking about research/example microprocessors that don’t have equivalent instructions. I mean isn’t branching a fundamental logical construct and we either do it in hardware with branch assembly operations or emulate functional equivalents of them in the soft…
What Spectre and Meltdown Mean for WebKit
251–260 of 294 posts
Re: What Spectre and Meltdown Mean for WebKit
#252Earlier quoted context omitted.
> There are websites that genuinely need to run some code, like webmails, Not really, not if you think about it. Webmail doesn't need anything more than html( > online trading platforms Ditto. > online games Honestly, I think running webgames in a super-sandboxed flash (or similar) runtime is the best thing to do. Again, no use for js on the web.
>Honestly, I think running webgames in a super-sandboxed flash (or similar) runtime is the best thing to do. Why is one ECMAScript sandbox (flash) so much better than another?
Re: What Spectre and Meltdown Mean for WebKit
#253Earlier quoted context omitted.
>Not really, not if you think about it. Webmail doesn't need anything more than html( Because redownloading the entire page every time you click a button is such a great experience...
The page without the javascript? It likely would be, since that would be much smaller.
Clicking "star" and losing your half-typed message would be very impactful, though.
Re: What Spectre and Meltdown Mean for WebKit
#254Earlier quoted context omitted.
Websites are only bloated because of the MB of javascript to make them applications (images do not count as they need to be rendered either way and can be cached). Most of the websites I visit every day don’t display that much content. Once gzipped it's a tiny file.
Yeah and if you visit a site everyday, the JS is cached, too. After the initial download, it shouln't be an issue. This is besides the fact that it should not take MBs of JS to make complex applications. The issue is what people are choosing to do with the tools, not the tools themselves.
Except that the current trend in webdev is to deploy small incremental changes multiple times per day and cache-bust the assets that change on each of those deploys. So the user is probably actually downloading the JS asset at least once per day Monday through Thursday (because no deploys on Fridays).
Re: What Spectre and Meltdown Mean for WebKit
#255Earlier quoted context omitted.
That sounds like a more extreme version of what the Cell[1] was supposed to be. Developers seemed to think that developing for that architecture was really painful, specially compared to other contemporary console platforms. I'd love it if the progress being made in the industry got us to actually being able to exploit the full potential of such architectures. [1]: https://en.wikipedia.org/wiki/Cell_(microprocessor)
It was painful - mostly because we don't have good tools for that sort of thing and most of our programming sort of hides the idea of multiple CPUs and pretends it's all working at once (in terms of us writing the code anyhow). It's all abstracted in a very linear way. Changing all that will take a lot of time if we do.
Re: What Spectre and Meltdown Mean for WebKit
#256Earlier quoted context omitted.
Commenting here works just fine without JavaScript.
Yes, but at the cost of: 1. Increased complexity on the server side to handle both cases. 2. Degraded experience on the client side (page reloading for simple actions like upvoting).
Re: What Spectre and Meltdown Mean for WebKit
#257Earlier quoted context omitted.
> Rust's `match` statement is a dynamic type check just like C++'s `dynamic_cast`. I wonder if this is a case of a difference in terminology, because enum variants (the branches in `match` expressions) aren't considered types in Rust, and have no interaction with Rust's typechecker (Rust always has to assume that every instance of an enum can be any variant, even in cases where we as the programmer know that only one…
Hypothetical example pseudocode: if is_pointer(pt): // do pointer-based stuff else: raise error If you train the branch predictor to expect a pointer, it will speculatively treat arbitrary values as pointers until it can determine that they are not. So you can pass in any value and get it treated like a pointer for the duration of the window of speculative execution. Any conditional branch is potentially vulnerable,…
Re: What Spectre and Meltdown Mean for WebKit
#258From the patches it seems that the write operation to the array is also protected with masking. What is the reason for it? If due to a bug unrelated to Spectre a JS code could trigger a write beyond the allocated memory, restricting writes to the next power of two just slightly complicates the attacks. This is very different from the reading situation.
As far as the attack: writing to memory pulls the effected page into the cache just as a read does
Re: What Spectre and Meltdown Mean for WebKit
#259Earlier quoted context omitted.
Yes, but at the cost of: 1. Increased complexity on the server side to handle both cases. 2. Degraded experience on the client side (page reloading for simple actions like upvoting).
Then let's standardize generic ways that permit things like upvotes without reloading the page and without executing externally supplied code. :-)
Re: What Spectre and Meltdown Mean for WebKit
#260Earlier quoted context omitted.
Have you considered arr[max(i, arr.len)] instead of AND?
Max() is not a CPU instruction. It's an abstraction, a function that could be implemented either using a branch (which defeats the whole purpose) or, on some architectures, with something like cmovXX. Perhaps they wanted a solution that works on Arm, which I think doesn't have cmovXX. Or maybe Intel does speculation with cmovXX used on array index.