CPU Introspection: Intel Load Port Snooping
gamozolabs.github.io
gamozolabs.github.io
He's put out the most detailed third-party documentation on Intel and AMD processors that I've ever seen.
This interesting novel technique [1] can provide an unique window inside the CPU core black box, helping us to better understand how the CPU works internally when it comes to otherwise invisible loads and stores.
While I can't think of any scenario immediately, intuitively I feel this could be useful for those of us seeking to squeeze everything out of a system.
Not the particular case about low level TLB miss / page walk mechanics (we already know TLB misses are bad), but perhaps there are other situations where existing performance counters don't provide as detailed information.
[0]: Yes, I'm aware INVPLG (Invalidate TLB Entries) used in this blog post is a privileged ring 0 instruction. But there's clearly a leak regardless.
[1]: Using a core hyperthread to "spy" other hyperthread on same core.
I'll be curious as to what there is to learn from this. It's more of a longshot goal for me to learn how things work, develop accurate uarch models, and then learn from those models better than I could guess and check hardware results.
Hard to say if it'll go well....
Emphasis on this issue, eh?
> I'll be curious as to what there is to learn from this...
I'm also very interested to see what you and the community can discover using this trick!
I'm sure we'll see more types of leaks, but unless they're actively fetching invalid data [1], there isn't much sensitive data to leak anymore.
I don't think there is much during speculation that can load _new_ data during that window.
[1]: So far almost every CPU bug has leaked something in an internal cache.
Are you talking about software context switches or hardware (hyperthreading) ones?
If HW threading constantly clears caches wouldn't it cause a huge performance loss? Isn't that something that can occur 1-100 million times per second?
Sadly, software context switch cache clearing is pretty much given these days.
It will not help you. Anything short of specially built CPU architecture and an OS is useless against hardware level "attacks," if you can even call them that.
CPUs are simply not built with an idea that you have to protect one process from another, and do it on that level of sophistication. You normally don't have that concern if the only person who can run code on a CPU is its user.
But the whole paradigm breaks when you have multiple "tenants" in a single systems, and whose entire setup is not managed by the host.
The same comes when you allow random untrusted code be JITed or even ran as is with WASM.
The only solution against that is to stop people from using "virtual" hosting, and remove JIT compilation of untrusted code.
CPU features like software controlled cache compartmentalization could also help, preventing cache related side channel leaks.
> The same comes when you allow random untrusted code be JITed or even ran as is with WASM.
If it's single threaded and WASM "syscall" interface doesn't provide anything that can be used as a clock, I don't see there's much to exploit — as long as each syscall interface itself is secure against direct and side channel attacks.
> ...remove JIT compilation of untrusted code.
You could probably still be able to exploit these issues, just somewhat slower. Also interpreters need to access memory, and those patterns are highly predictable.
As evidenced by the struggles of browser developers, making a solid sandbox is -hard-. They've been trying to make JS secure and sidechannel free for a good part of 15 years now, and there are still issues found every quarter.
Could anyone help explain, in a few sentences, what is a Load Port, and why is it interesting in this context?
It appears to be some type of indicator of the proportional time slice given to certain opaque internal processes which are not normally visible to users.
So getting a trace from the load ports is basically a trace of all memory accesses in the system. Something particularly cool about this work is that you can even see loads that are hidden from software, like a hardware page table walk.
Kinda neat, but it's not a thing anymore.
Some more info here: https://stackoverflow.com/questions/14332848/intel-x86-0x2e-...