Re:Understanding Spectre and Meltdown – Part 2
by mridulv09 on Sunday March 25, 2018 @02:49AM
(#16671089)
In most of the articles which i read or have have linked in the blog, most of them were about KPTI being the mitigation for the meltdown fix.
Actually now, with context switch to kernel mode, we now have to load the page table entries ( process + kernel ) which will essentially mean flushing of the TLB. But this is a side effect of the mitigation and not the main mitigation.
No the fix for meltdown is to essentially force a tlb flush (as Linux is doing).
Note that only resolves is reading kernel memory, it doesn’t resolve Spectre. That basically requires browsers to be super sure about their bounds checking logic.
I don’t know what other engines did, but in JSC all indexing operations are now essentially:
If (idx < length) return data[idx & mask]
Where each indexable object stores a length mask that is essentially the next power of two up from the length.
It takes up space on every object (a word for the mask) reuquired removing butterflies and had a significant perf impact :-/
I’m 100% sure @pizlonator will say I have completely bollocksed up this description :)