More lfence excitement
So I assume many people on this list are occasionally in touch directly with the TU Graz people, so this comes as no surprise, but just FYI in case you aren't: they have some tests that indicate that lfence isn't quite the fence for speculative execution that it was supposed to be.
Their tests says that under heavy interrupt loads, speculative instructions may in fact be executed even after the lfence. We'll see what Intel's reaction to that is.
I can imagine a few ways it could be true, mainly something along the lines of "pending interrupt kills off speculative execution of slow-and-or-complex instructions for lower interrupt latency", where the complex "lfence" might be dismissed early due to a pending interrupt, but the regular simple instructions end up killed the usual way at retirement instead.
And maybe the Graz data isn't right for some other reason, who knows. Their test program didn't really work all that well for me.
They also have an entirely remote attack that depends on timing of network packets, which looks cute. The data rate is pretty low unless you're on the same local network (which generally isn't a very interesting attack, and even then it's pretty low - just not ridiculously so), but they were able to time packets even within a cloud setup using 20 million packets (for one bit). So they could leak a byte of data in a few hours.
That's likely not very interesting on its own, although it's cute. But breaking KASRL remotely using it is possible, so it could be the beginning to a second attack.
This is all under embargo, of course. And no, the "lfence isn't 100% safe" thing doesn't necessarily mean that anything *else* would be better, since even a serializing instruction might have similar issues. So even if it's true (and let's see what Intel ends up discovering), I don't think it's anything we should necessarily worry about. It's also likely not really an issue in practice.
The network timing thing is cross-architecture (they did it on ARM too) and independent of the lfence thing. I suspect that too isn't really all that practical, but it _is_ cute.
Linus
Quoted 7 lines · speck for Linus Torvalds
They also have an entirely remote attack that depends on timing of network packets, which looks cute. The data rate is pretty low unless you're on the same local network (which generally isn't a very interesting attack, and even then it's pretty low - just not ridiculously so), but they were able to time packets even within a cloud setup using 20 million packets (for one bit). So they could leak a byte of data in a few hours.
FWIW from the scattered data I've seen, on a single LAN segment (which might have characteristics similar to at least some more directly interconnected "cloud" setups) using the AVX2 trick it's getting somewhere close to 60 bits per hour. Not *dramatically* faster, but still an order of magnitude.
Signature · 2 lines
Jiri Kosina SUSE Labs
Quoted 9 lines · speck for Linus Torvalds
So I assume many people on this list are occasionally in touch directly with the TU Graz people, so this comes as no surprise, but just FYI in case you aren't: they have some tests that indicate that lfence isn't quite the fence for speculative execution that it was supposed to be.
Their tests says that under heavy interrupt loads, speculative instructions may in fact be executed even after the lfence. We'll see what Intel's reaction to that is.
Quoted 6 lines
I can imagine a few ways it could be true, mainly something along the lines of "pending interrupt kills off speculative execution of slow-and-or-complex instructions for lower interrupt latency", where the complex "lfence" might be dismissed early due to a pending interrupt, but the regular simple instructions end up killed the usual way at retirement instead.
This is pretty nasty indeed.
If I was a half younger, I'd say this could have been resolved by implementing this speculation fence as a new variant of retpoline, that just jumps to the next instruction.
But after the havoc around Bounds Check Bypass Store I am not really sure how come retpolines actually do work reliably (the "reading return value directly from the value that's been speculatively stored to stack" thing), so .. interesting.
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs
Quoted 4 lines · speck for Linus Torvalds
So I assume many people on this list are occasionally in touch directly with the TU Graz people, so this comes as no surprise, but just FYI in case you aren't: they have some tests that indicate that lfence isn't quite the fence for speculative execution that it was supposed to be.
Indeed. They let me know about this as well. For those who care, it also extends to certain instruction sequences on other architectures. I have reference code (privately) from Graz and am reviewing it at the moment.
Quoted 3 lines
Their tests says that under heavy interrupt loads, speculative instructions may in fact be executed even after the lfence. We'll see what Intel's reaction to that is.
Indeed.
Quoted 6 lines
I can imagine a few ways it could be true, mainly something along the lines of "pending interrupt kills off speculative execution of slow-and-or-complex instructions for lower interrupt latency", where the complex "lfence" might be dismissed early due to a pending interrupt, but the regular simple instructions end up killed the usual way at retirement instead.
This is my pet theory also, that they see an interrupt tagged for delivery and say "oh ok, don't worry about that lfence".
Quoted 6 lines
They also have an entirely remote attack that depends on timing of network packets, which looks cute. The data rate is pretty low unless you're on the same local network (which generally isn't a very interesting attack, and even then it's pretty low - just not ridiculously so), but they were able to time packets even within a cloud setup using 20 million packets (for one bit). So they could leak a byte of data in a few hours.
Please folks, keep this one very confidential. The NetSpectre paper should have been disclosed to a few folks (I specifically requested that SuSE and Canonical get copies as well). It's useful to nation state actors operating against certain big players and mitigations are in flight beyond the OS at the moment. In the case of NS (which Red Hat folks can refer to as BlinkyShadow on our end please) the bit rate is up to 60 bits per hour with the AVX register file power down hacks.
Quoted 3 lines
The network timing thing is cross-architecture (they did it on ARM too) and independent of the lfence thing. I suspect that too isn't really all that practical, but it _is_ cute.
For the record, AMD are disclosed on this, and I connected IBM with Graz to discuss it a few weeks ago. A number of others who fear external foul play from certain states are working on mitigations beyond Linux.
FWIW I will be in Austria next Tuesday at Graz going over their latest research. Please let me know if you have questions for me to raise. I am already going to go over a few future things with them, and talk through how they're doing uncached reads of explicitly uncached memory (which I suspect to be related to Intel ignoring the MTRR/PAT in favor of something like a SAD table identifying memory types).
Jon.
Signature · 1 line
Computer Architect | Sent from my Fedora powered laptop
Quoted 10 lines · speck for Jon Masters
Quoted 4 lines · speck for Linus Torvalds
So I assume many people on this list are occasionally in touch directly with the TU Graz people, so this comes as no surprise, but just FYI in case you aren't: they have some tests that indicate that lfence isn't quite the fence for speculative execution that it was supposed to be.
Indeed. They let me know about this as well. For those who care, it also extends to certain instruction sequences on other architectures. I have reference code (privately) from Graz and am reviewing it at the moment.
My guess (as I told Graz) is that the heavy interrupt load effectively forces in-order dispatch[0] of the instructions close to the lfence, then the lfence and subsequent speculative instructions hit the execution ports at the same moment. I believe there is then likely to be a small window before that lfence kills speculation during which already dispatched instructions are still in flight and under speculative mode.
Graz did some further testing at my request by inserting additional instructions between the fence and subsequent speculative path. They were /unable/ to leak data if they added more than a small number and are currently pursuing this as a possible explanation.
I'm confirmed at Graz next Tue and will review.
Jon.
[0] Continual interrupts will effectively mean many ROB entries are tagged with interrupt pending and speculation is killed frequently, so the out of order window is very small under load.
Signature · 1 line
Computer Architect | Sent from my Fedora powered laptop