8 ms·
This is great, but remember that it covers Meltdown, not Spectre. Meltdown is the more immediate disaster, but Spectre is the more batshit vulnerability. You re
by tptacek 9y ago
This is great, but remember that it covers Meltdown, not Spectre. Meltdown is the more immediate disaster, but Spectre is the more batshit vulnerability. You really want to get your head around:
* The branch target injection variant of Spectre if you want to get a sense of how amazing this vulnerability is: you can spoof the branch predictor to trick a target process into running arbitrary code in its address space! This is crazy!
* The misprediction variant of Spectre if you want to get a hopeless feeling in the pit of your stomach, since the implications of mispredict are that certain kinds of programs are riddled with a new kind of side channel we didn't really grok until last week, and no upcoming microcode update seems to be in the offing.
You could probably use the same Python conceit to illustrate the other two attacks; someone might take a crack at that.
(I'm not disputing that the R-Pi's aren't vulnerable to Spectre).
- claytonjy 9y agoI too would love to see the continuation you suggest. This was a great article, and I was sad to see it end, since I was hoping to grok a little more about the technical differences between Meltdown and Spectre.
- ploxiln 9y agoThis covers both Meltdown and Spectre. > Both vulnerabilities exploit performance features (caching and speculative execution) common to many modern processors to leak data via a so-called side-channel attack. Happily, the Raspberry Pi isn’t susceptible to these vulnerabilities, because of the particular ARM cores that we use. The reason why Spectre is not a problem is because there is no branch predictor in these simpler arm cores. Instructions are processed in parallel when possible, but not before dependencies, including branch decisions. EDIT: under "What is speculation?" branch prediction is described. Then in the conclusion: "The lack of speculation in the ARM1176, Cortex-A7, and Cortex-A53 cores used in Raspberry Pi render us immune to attacks of the sort."
- tptacek 9y agoI'm not arguing that R-Pi's are vulnerable to Spectre.
- ploxiln 9y agoYou're arguing that this article does not cover Spectre. It does ... it just doesn't have to fully describe spectre to show why the raspi is not affected.
- deleted 9y ago[deleted]
- loeg 9y agoThere is almost certainly a branch predictor even in these simple ARM cores.
- ploxiln 9y agoAh, that's good to know ... a comment below mentioned a "BTAC" (branch target access cache). Is it just used for getting instructions into the L1i cache then?
- piinbinary 9y ago(Asking for my own edification) What does the output of branch predictor get used for in a CPU without speculation?
- quasse 9y agoAvoiding having to empty the instruction pipeline when a branch happens and restart. My favorite simple video explaining pipeline is still this old Apple one from back in the early 2000s: https://youtu.be/PKF9GOE2q38?t=237 https://youtu.be/PKF9GOE2q38?t=237
- cwzwarich 9y agoIt is used to determine which instructions to fetch and decode, so that you don't have to wait until the branch is resolved to query the instruction cache, instruction TLB, MMU, DRAM, etc. If the branch was mispredicted, you have to stall to wait for this to complete.
- msbarnett 9y agoIn a pipelined CPU, you want to start the memory fetches for which instructions to next feed into the instruction decoder, before the branch instruction has finished the execute stage. Otherwise every branch incurs a pipeline bubble.
- PeterisP 9y agoIf you're doing speculative memory fetches, wouldn't that also leave a measurable impact on the cache? Simply instead of MOV AX, [something that depends on secret value] as in the original Meltdown paper you'd need to use JMP [something that depends on secret value] to trigger the memory fetch in a branch that's not going to be used.
- makomk 9y agoA lot of the cheaper Pi-like boards also aren't affected for the same reason, as are lower-end Android phones. The articles claiming it affected every modern CPU were basically mistaken. It was an easy mistake to make, given that ARM's announcement only listed the cores that were affected and had a little note saying everything not listed was unaffected by both Meltdown and Spectre. (There is precisely one ARM-designed core that is affected by Meltdown, a high-end one so new that no chips based on it have been released yet.)
- davrosthedalek 9y agoOne could argue that CPUs without branch prediction are not modern in the sense of "modern, state of the art design". The fact that they still produce,e.g. 8051, even "new" overall designs, doesn't make the 8051 modern.
- zzzcpan 9y agoBranch prediction is neither new nor modern. Modern state of the art design doesn't actually do branch prediction in hardware at all. I mean look at all the ideas from VLIW architecture, no hardware - no problems.
- haimez 9y agoYou're being pretty silly by zeroing in on the word modern and then using an equally silly redefinition of it yourself. Branch prediction isn't new, you're right. But VLIW instructions are equally unmodern and are entirely orthogonal to speculative execution. Sufficiently smart compilers are also no substitute for runtime analysis.
- harlanji 9y agoMy CS book (Bryant and O'Hallaron, 2003, p. 399) says Control Data 6600 in 1964 was the first processor w out of order executuon, considered exotic until RS/6000 by IBM in 1990/PowerPC 601 in 1993.
- katastic 9y agoOld Atoms also don't have a branch predictor. The new ones might? IIRC, they were basically "low power" versions of the desktop CPUs by ripping out all the expensive branch prediction / out-of-order speculation parts. I used to know this more because I was reading intentionally on it, but old age and years passing kind of rots the memory. [edit] Yep: >every Intel processor since 1995 that implements out-of-order execution is potentially affected by Meltdown – except Itanium, and the Atom before 2013. http://www.theregister.co.uk/2018/01/04/intel_meltdown_spectre_bugs_the_registers_annotations/ http://www.theregister.co.uk/2018/01/04/intel_meltdown_spect... So "every Intel CPU" is correct enough for the general public to scare most people (as it is potentially a huge problem), but it's incorrect in the sense it doesn't apply to ALL Intel CPUs. Atoms are very popular in netbooks. (And the Itaniums exception we can ignore because a handful of machines across the entire planet are running them.)
- deleted 9y ago[deleted]
- fyi1183 9y agoIf you don't feel overwhelmed enough by the misprediction variant of Spectre yet, consider that the cache side effect of speculation is actually desirable in most normal cases, because it helps prime caches with data that is likely to be used in the correct branch as well. Just turning it off is not the right way to solve this. Perhaps this will finally provide enough incentives to model data sensitivity in the type systems of practical programming languages.
- astrange 9y agoIt would be hard to model data-dependent timing of an actual CPU. Integer division is variable time on lots of architectures, but on ARM even multiplication timing is data-dependent! And on desktops you could cause a even mov instruction to stall a few cycles if you can run something before it that uses all the renamed registers - there might be a way to turn this into data dependence and observe it from the perf counters…
- sitkack 9y agoAll shortcuts leak information. Anything with the equivalent of an early return leaks information.
- fyi1183 9y agoYou don't need to model the timing though. What I'm saying with the type system comment is this: the cache side effects of speculation are desirable most of the time but not always. We should find a way to model data sensitivity in the type system so that a compiler can automatically choose to generate a side-effect-free code sequence where the side effects must be avoided (this assumes a future with ISA extensions that allow telling the CPU to prevent such side effects by blocking the speculative execution).
- JdeBP 9y agoMicrocode updates in the offing: * https://lists.opensuse.org/opensuse-security-announce/2018-01/msg00004.html https://lists.opensuse.org/opensuse-security-announce/2018-0... (https://news.ycombinator.com/item?id=16081366 https://news.ycombinator.com/item?id=16081366) Future microcode updates mentioned: * https://newsroom.intel.com/wp-content/uploads/sites/11/2018/01/Intel-Analysis-of-Speculative-Execution-Side-Channels.pdf https://newsroom.intel.com/wp-content/uploads/sites/11/2018/... (https://news.ycombinator.com/item?id=16079910 https://news.ycombinator.com/item?id=16079910)
- tptacek 9y agoThose updates cover Meltdown and Spectre 2, not Spectre 1.
- frik 9y agoThanks for the confirmation and inside info! Yesterday we only guessed it https://news.ycombinator.com/item?id=16069740 https://news.ycombinator.com/item?id=16069740 based on ARM CPU list, the RPi 1-3 CPUs ARM11, Cortex-A7, Cortex-A53 aren't in the list. Affected ARM cores: Cortex-R7, Cortex-R8, Cortex-A8, Cortex-A9, Cortex A15, Cortex-A17, Cortex-A57, Cortex-A72, Cortex-A73, Cortex-A75 https://developer.arm.com/support/security-update https://developer.arm.com/support/security-update (I tried to post it 3 hours ago, but HN is rate-limiting my posts, oh well)
- pslam 9y agoAt least in the case of Cortex A-7, there's about 2-3 cycles (maybe 3-4 instructions with dual-issuing) before a branch mis-predict causes a pipeline flush. You can maybe fit a couple of loads into that time, and maybe one of them will result in a Dcache fill. Other in-order cores in the Cortex-A line have similar Dcache side-effect under mis-predict. It's not clear whether this actually leads to speculated Dcache fills, though. So it's possible that some of the Raspberry Pi versions are in fact vulnerable to (much weaker versions of) Meltdown and Spectre.
- DannyBee 9y agoIt's not all that hopeless, actually. Let's ignore meltdown, which seems solvable in hardware with no obvious performance loss (assuming amd's existence proof is correct), and concentrate on spectre, which everyone thinks means the world is ending. One thing to note is that compilers have been safely speculating instructions for years. Shocking, i know :) Processors could too. They just weren't. One of the cardinal rules of safe speculation is that you can't speculate an instruction unless you can prove it has no observable side-effects (ie possibly faulting, or in this case, ending up in cache), or that the side-effects are the precisely the same whether you speculate it or not (where "precisely the same" generally includes some notion of ordering of side-effect occurrence. i'm not going to get into all the various intricacies) IE a+b -> safe to speculate, has no side effects load a -> generally unsafe, has possible observable side effects if foo: load a else load a -> safe to speculate load a to right above the if, it must always be executed, and in this example, side-effects will be the same. if foo: load a -> not safe to speculate load a above the if, it may not execute Compilers generally did not speculate loads, mainly because they can fault at that level[1]. The fault comes from the processor though. So processors were/are assuming that speculation of loads, calls, etc, had no side effects because they could "throw away the results". As the processor controlled the faulting, it could just throw away the fault and pretend it never happened. These two attacks are just proving that is not true, and the side-effects of computation themselves are observable. The end result should be the same. Processors speculate more like compilers do: only in safe situations. The idea that you have to give up all speculative execution seems very wrong. You only have to give it up in cases where there are possibly observable side-effects and it's not guaranteed they will always happen. The upshot is the most likely outcome is that both processors and compilers will work harder to speculate. Compilers will get called upon to do more safe speculation. Processors will have to grow the logic to determine when speculation is safe (or figure out a way to actually undo all side effects, which is fairly hard). Now, the downside is the most useful speculation is obviously to hide load/store latency, and those things are the hardest to reason about safety. But like i said, compilers have been doing it for many years at this point. Our hardware brethren just found out the hard way that they are likely to start having to do it too, and that there are more observable side-effects than they thought. [1] Some JITs do it and catch the result in a fault handler if it turns out badly. I expect someone is going to discover ways to exploit all of these basically instantly. These will not be fixed by processor related fixes because they are not processor directed.
- sillysaurus3 9y agoBy the way, didn't cperciva point out this vuln way back in 2005? http://www.daemonology.net/papers/htt.pdf http://www.daemonology.net/papers/htt.pdf Actually that seems to be rather different, but still similar-ish. They both use threads to exploit memory caches in an unexpected way. I thought he deserved a mention since no one really took it seriously back then. https://it.slashdot.org/story/05/05/13/0520214/hyperthreading-considered-harmful https://it.slashdot.org/story/05/05/13/0520214/hyperthreadin... http://freerepublic.com/focus/f-news/1406913/posts http://freerepublic.com/focus/f-news/1406913/posts "The recent Hyper-Threading vulnerability announcement has generated a fair amount of discussion since it was released. KernelTrap has an interesting article quoting Linux creator Linus Torvalds who recently compared the vulnerability to similar issues with early SMP and direct-mapped caches suggesting, "it doesn't seem all that worrying in real life." Colin Percival, who published a recent paper on the vulnerability, strongly disagreed with Linus' assessment saying, "it is at times like this that Linux really suffers from having a single dictator in charge; when Linus doesn't understand a problem, he won't fix it, even if all the cryptographers in the world are standing against him." Always found that amusing.
- tptacek 9y agoCache timing goes back to at least 2005 with Osvik and Tromer. This isn't a simple cache timing bug, though.
- cperciva 9y agoCache timing goes back to 2005 with Percival. I published a couple weeks before them. :-)
- nickpsecurity 9y ago"Cache timing goes back to at least 2005 with Osvik and Tromer. This isn't a simple cache timing bug, though." (tptacek) "Cache timing goes back to 2005 with Percival. I published a couple weeks before them. :-)" (cpercival) Cache timing goes back to the VAX Security Kernel (early 1990's) designed for those A1 certification requirements that tptacek calls useless, "red tape." One of the mandated techniques was covert, channel analysis of whole system. They found lots of side channels in hardware and software they tried to mitigate. Hu found one in CPU caches following with a design to mitigate it. That was presented in 1992. https://news.ycombinator.com/item?id=16083384 https://news.ycombinator.com/item?id=16083384 Since Hu is paywalled, see (b) "cache-type covert timing channels" in his patent: https://www.google.ch/patents/US5574912 https://www.google.ch/patents/US5574912 So, one of INFOSEC's founders (Paul Karger) did the first, secure VMM for non-mainframe machines. The team followed the security certification procedures discovering a pile of threats that required fixes from microcode for clean virtualization to mitigation of cache, timing channels. They published that. Most security professionals outside high assurance sector and CompSci ignored and/or talked crap about their work presumably without reading it. Those same folks reported later on virtualization stacks hit in 2000's with the attack from 1992 on new software with weaker security than KVM/370 done in 1978. Now, another attack making waves uses the 1992 weakness combined with another problem they discovered by looking at what interacts with it. That might have been discovered earlier if they did that with x86 like high-assurance security (aka "red tape") did in 1995 for B3/A1 requirements with them spotting potential for SMM and cache issues: https://pdfs.semanticscholar.org/2209/42809262c17b6631c0f6536c91aaf7756857.pdf https://pdfs.semanticscholar.org/2209/42809262c17b6631c0f653... Note: High-assurance security was avoiding x86 wherever allowed by market for stuff like what's in that report. As report notes with exemplar systems, market often forced it to detriment of security. Their identification of SMM as a potential attack vector preempted Invisible Things by quite a bit of lead time. That was typical in this kind of work since TCSEC require thoroughness. In 2016, one team surveyed the components plus research on them in a modern CPU. Researchers had spotted branching as a potential, timing channel pretty quickly after CPU's got mainstream attention. https://eprint.iacr.org/2016/613.pdf https://eprint.iacr.org/2016/613.pdf So, a team following B3 or A1 requirements of TCSEC for hardware like in 1990-1995 would've identified the cache channels (as done in 1992) plus other risky components. They'd have applied a temporal or non-interference analysis like they did with secure TCB's in 1990's to early 2000's. A combination of human eyeballs plus model-checking or proving for interference might have found recent attacks, too, given prior problems found in ordering or information flow violations. This is a maybe but I say focusing on interactions with known-risks would've sped discovery with high probability. Far as resources, it would be one team doing this on one grant using standard, certification techniques from mid-1980's on a CPU others analyzed in mid-1990's say it was bad for security due to the cache leaking secrets, too many privileged modes, various components implemented poorly, and so on. I keep posting this stuff on HN, Lobste.rs, and so on since it's apparently (a) unknown to most new people in the security field for who knows what reason or (b) dismissed by some of them based on the recommendations of popular, security professionals who have clearly never read any of it or built a secure, hardware/software system. I'm assuming you were unaware of the prior work given your scrypt work brilliantly addressed a problem at root cause quite like Karger et al did when they approached security problems. The old work's importance is clear as I see yet again well-known, security professionals are citing attack vectors discovered, mitigated, and published in the 1990's like it was a 2005 thing. How much you want to bet there's more problems they already solved in their security techniques and certifications that we'd profit from applying instead of ignoring? I encourage all security professionals to read up on prior work in tagged/capability machines, MLS kernels, covert channel analysis, secure virtualization, trusted paths, hardware security analysis, and so on. History keeps repeating. It's why I stay beating this drum on every forum.
- aplorbust 9y agoHow many RPi users are using this board to run untrusted code? The RPi may mitigate risk of these attacks simply in the way it is used. Perhaps hobbyists use it to run their own small programs, not random third party Javascript in an enormous web browser from some corporation.