Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown
by gpderetta on Saturday January 06, 2018 @08:08AM
(#16085111)
I doubt that any CPU manufacturer is going to go first in crippling its memory subsystem.
I think realistically the only safe and not completely performance crippling workaround will be, at the very least, to run any untrusted code under a separate address space (assuming that the cpu is immune from meltdown). That doesn't necessarily require a full blown separate process, but something like memory protection keys might work.
The alternative is full static analysis and source level annotations, which realistically is only going to be done for very few programs and will still be error prone.
Re:Why Raspberry Pi Isn't Vulnerable to Spectre or Meltdown
by DannyBee on Saturday January 06, 2018 @01:37PM
(#16086727)
Yeah, i don't disagree at all.
Something like this what i meant by "cooperation" (lfence or equivalent for code that can't be isolated but must be protected) + "weird abstractions" (IE back to segmented land we go)
Yes, it is. Remember, again, that the vast majority of those instructions can still be speculated, because the vast majority of instructions are not loads or stores.
Now, certainly, the expensive ones are loads and stores, but i'm just pointing out that the hundreds of instructions you are talking about in the buffer are mostly not loads and stores.
It's true that lowering memory level parallelism would be a huge blow, as the vast majority of time in well-tuned cpu bound apps is usually spent in stalls waiting for memory (otherwise, if it's really just arithmetic bound, it may make more sense to run it on a GPU or something), and this would just increase it.
The real question is what percent can you prove are safe to speculate, and at what point can you prove that safety (ie assuming it must be dynamically speculated, can you prove safety with enough cycles left that it matters). If you have 5 instructions, yeah, no, probably not.. But it may also be the case that the execution environment can prove it safe for you as the program executes and tell you.
I expect getting back this performance is going to be done using a variety of methods, some cooperation between jits/compilers and processors, and possibly some weird abstractions around marking memory you want to protect or not (IE not speculate around).
I mean, in the absolute worst case, you could make loads/stores take constant time and speculate as much as you like :)
It's just that this has a much higher performance cost right now than not speculating at all (by a few orders of magnitude)