20 ms·
The new microcode from Intel and AMD adds three new features
- deleted 9y ago[deleted]
- DSingularity 9y ago4,000 cycles for a speculative execution barrier is just horrible. Since everyone needs a patched kernel, might as well take the time to recompile the kernel with retpoline compiler and remove all offending instructions in the first place.
- kuschku 9y agoExcept, thanks to modern speculative execution, skylake and later also speculates through retpoline. So you still need some solution there.
- trishume 9y agoI'm pretty sure it's not that it speculates through retpoline, IIRC retpoline is coded with trickery to avoid that, but it only replaces indirect branches. It's that it speculates through normal `ret` instructions in functions, in a way that can be exploited.
- BeeOnRope 9y agoIt's that prior to Skylake, ret instruction prediction only ever used the "return stack buffer" (RSB), but since Skylake the indirect predictor is used as a backup. The RSB is a prediction mechanism specifically for call and ret pairs: each ret is predicted to return the instruction following the corresponding call. This works great for the common pattern of matched pairs, but the stack used to track outstanding calls has a limited size (32 in Skylake), let's call it N. If you have N + M calls followed by N + M rets (or any other pattern where the call chain gets that deep), you will predict correctly the first N rets, but then the stack is exhausted and the last M rets won't be predicted by the RSB. Prior to Skylake, those last M rets just wouldn't get predicted at all (probably instruction fetch would just fall through to the instructions following the ret), but in Skylake the indirect branch-predictor, which is usually used to predict jmp or call instructions to variable locations, is used as a fallback instead. So the concern is that people could train the indirect predictor prior to a kernel call, and if the 32-deep RSB was ever exhausted, the indirect predictor could kick in causing a Spectre-like vulnerability.
- nimbius 9y ago"since the peanut gallery is paying lots of attention it's probably worth explaining it a little more for their benefit." what a ridiculous sentiment to defend a patch from Intel thats effectively disabled by default for one of the most egregious bugs in microcode since F00F. "The new microcode from Intel and AMD adds three new features." No ones talking about AMD, David, not Linus and certainly not hackernews or other outlets. Spectre patching will happen regardless of this fiasco but This NOT SPECTRE. this is a taylor made shit sandwich thats been warned about by researchers and lurking on Intels plate for more than a decade. intel chose speed over security, and intel lost. Now they're trying to find a way --any way-- to avoid having to eat an 8 generation recall or worse. its been said on HN before, but this is now more of an 'if not when' of intels loss of dominance in cloud. customers no longer care about the fastest chip in the west if its going to get neutered to half speed due to wreckless design that allows for a complete security disaster. Theyll buy twice as many AMD, at half the price of intel, and make up the difference in sheer volume.
- phonon 9y agoDavid Woodhouse works for AWS, not Intel. So maybe take it down a notch?
- paulie_a 9y agoWhile the op may have mistaken the author, the point is valid on numerous levels, including attempting to slander AMD because Intel has bad designs
- phonon 9y agoUmm, no. This is about Spectre variant 2, which AMD is 100% exposed to. "GPZ Variant 2 (Branch Target Injection or Spectre) is applicable to AMD processors." https://www.amd.com/en/corporate/speculative-execution https://www.amd.com/en/corporate/speculative-execution
- oneweekwonder 9y agoMaybe I'm sensitive but "peanut gallery" felt derogatory. A quick google gave me "the top gallery in a theatre where the cheaper seats are located." which I feel is quite fitting... As we sit here and watch how this dystopia future plays of around us and how corporations want to dodge responsibility.
- shakna 9y ago> But wait, why did I say "mostly"? Well, not everyone has a retpoline compiler yet... but OK, screw them; they need to update. That got me interested, who has reptoline support, and from when? GCC added support in 7.2 [0], which means a lot of people don't have access yet. LLVM added it in D41723 [1], but I don't think that has landed in a release yet. I can't find any talk around TCC, but that isn't exactly surprising. Haven't heard anything about MSVC, and can't find anything, but that's not surprising as I don't think Windows is using reptoline in their mitigations, but I really have no idea. [0] https://www.phoronix.com/scan.php?page=news_item&px=Clear-Linux-Retpoline-KPTI https://www.phoronix.com/scan.php?page=news_item&px=Clear-Li... [1] https://reviews.llvm.org/D41723 https://reviews.llvm.org/D41723
- taspeotis 9y agoI'm not sure how close this is to the retpoline mitigation but ... https://blogs.msdn.microsoft.com/vcblog/2018/01/15/spectre-mitigations-in-msvc/ https://blogs.msdn.microsoft.com/vcblog/2018/01/15/spectre-m... Our tests show the performance impact of /Qspectre to be negligible. We have built all of Windows with /Qspectre enabled and did not notice any performance regressions of concern. Performance gains from speculative execution are lost where the mitigation is applied but the mitigation was needed in a relatively small number of instances across the large codebases that we recompiled.
- shakna 9y agoThanks! I think that and the inner-linked post tell us what we need to know. From Terry's post: > For context, on newer CPUs such as on Skylake and beyond, Intel has refined the instructions used to disable branch speculation to be more specific to indirect branches, reducing the overall performance penalty of the Spectre mitigation. And your link: > /d2guardspecload, that is currently equivalent to /Qspectre. It seems equivalent to reptoline, at least from a high level perspective. So MSVC is probably protected, but only optionally. They're leaving it up to developers to use the /Qspectre flag, it isn't something automatically enabled when you use an /O(x) optimise flag. Edit: I should add that /Qspectre is currently being added to a lot of Windows, but they're assessing where before doing so, because not everywhere should need it.
- summiwap 9y agoI have always felt it, but presumed it was "cross talk" in the optical nerves being interpreted as "movement" in the outer ear.
- Operyl 9y agoI think you might’ve commented on the wrong post somehow there.
- el_benhameen 9y agoWhat's very odd is that it's a copy of the first sentence of this comment: https://news.ycombinator.com/item?id=16218608 https://news.ycombinator.com/item?id=16218608
- nitrogen 9y agoAccidental copy/paste through an interface for the visually impaired? > about: Visually Handicapped but can handle computer online work
- el_benhameen 9y agoHuh, that's a good point. Apologies if my comment came off as accusatory.
- nitrogen 9y agoI think your comment was fine. I would have had the same kind of thought -- possible bot trying to age an account with content lifted from other legit posts.
- eitland 9y agoWow. You made me smile. Took the effort to investigate, identify a good reason and defend. Thanks!
- gaius 9y ago
- thomastjeffery 9y agoSince all these CPUs are turning out to be so inherently insecure, maybe we should work harder to run only trusted/verified code.
- MontagFTB 9y agoThere’s a limit at which improving the car compensates for the degradation of the road. At some point, repaving is the only correct fix.
- deleted 9y ago[deleted]
- Beltiras 9y agoIs retpoline the equivalent of picking another road in this analogy?
- SolarNet 9y agoMore like picking special tires that can run on the shitty road. The roads are the hardware itself and their vendors (I would assume).
- Beltiras 9y agoI can see that making sense. Still see the retpoline reducing the forks in the road, forcing the "proper route".
- SolarNet 9y agoNo you still misunderstand. The road in the analogy is the hardware itself. And the car is the OS. The OP's point was that we have to replace the hardware, because at some point you are hacking up your car to absurd degree just to be able to drive on the road of the hardware. It has nothing to do about forks in the road and the analogy to branching. He could be arguing for anywhere from, we need to replace all our hardware now, to we need to start over with how we design chips.
- ploxiln 9y agoThat link doesn't seem to show the continuation of the thread, but it continues to be rather interesting: https://lkml.org/lkml/2018/1/23/25 https://lkml.org/lkml/2018/1/23/25 It looks like Ingo Molnar, Andi Kleen, and others are coming up with a pure-software alternative to IBRS, which could be much faster (rather similar in spirit to the retpoline trick)
- poizan42 9y agoIt is linked at the left of the screen where it says "Messages in this thread"
- phs2501 9y agoSemi off-topic: What is up with the lkml.org threading interface and why is it so ridiculously inconsistent? I've always found it really frustrating that lkml.org seems to be the canonical web link that comes up for kernel mailing list discussions because of this, as I really find the threading there frustrating; it's nearly impossible to determine whether you've read the entire (sub-)thread. Back when Gmane was alive I usually gravitated there as an alternative.
- the-real-jap 9y agolkml.org owner here; let me explain the current behaviour: If available, it shows you the grandparent message and all its descendants for up to four levels (so n-2 to n+2), and if you navigate to another message it will just do that again - which means that the whole tree will change. Suggestions (or working links to what you like better) are welcome!
- dzdt 9y agoHow about just show the whole thread? If it is a huge thread, so be it, we want to know.
- cesarb 9y agoA simple enhancement would be to show (for instance with "...") if there are more levels, that is, if there's a n-3 or n+3, put a ... where it would be. That would make it at least a little bit easier to navigate, by making it explicit when you're seeing an incomplete view of the thread.
- paulie_a 9y agoThat is one of the most mobile unfriendly sites I have ever seen
- axaxs 9y agoMy 2 unasked for pennies - the kernel is already too bloated with support. These are hacks and should not be mainlined. Let them fix their hardware and give arduous instructions to patch...they deserve it. Don't further pollute the kernel. Imagine if a tiny hardware vendor tried the same...ubiquity is not an excuse.
- oneweekwonder 9y ago> My 2 unasked for pennies - the kernel is already too bloated with support. Is this not the ultimate fate for any monolithic kernel? Because by design you need to add everything to the kernel. While these patches might apply to micro kernels as well. I wonder if there is kernels that abstract the cpu into a device driver to even keep microcode bloat out of your kernel? As a side thought; If you abstract your cpu like this; will it allow you to hot-swap your os between devices and architectures?
- axaxs 9y agoIt is. I'm very much against mono kernels, but it is what we have. Let Intel side patch like grsec.
- Someone 9y ago”Let them fix their hardware” That could (and, I guess, would) mean a much, much, larger performance hit than a combined microcode/kernel fix would give. I doubt people would be happy about that. Given that we don’t want to give up all speculated instruction execution, it will be difficult to find the spot where we get safety at minimal performance impact.
- gaius 9y agoRight, but why should OS devs and vendors scramble to save Intel’s share price? The right outcome here is for the devs to do nothing and the world switch to another CPU vendor on the next hardware refresh cycle.
- 9y ago
- davidlt 9y agoOn ARM (A64, A32, T32) we get CSDB barrier, but it's a hint instruction instead of going via MSR registers. From whitepaper CSDB is 1101_0101_0000_0011_0010_0010_100_11111 Here some snippets from ARM manuals: HINT instruction: 1101 0101 0000 0011 0010 0010 100 11111 CRm = 0010 op2 = 100 Some encodings described here are not allocated in this revision of the architecture, and behave as NOPs. (This is important) Hints 18 to 23 variant Applies when CRm == 0010 && op2 != 00x. HINT #<imm> Hint is encoded in CRm:op2 pair, existing similar: 0010:000 ESB // Error Synchronization Barrier 0010:001 PSB CSYNC // Profiling Synchronization Barrier Thus in assembler this is written: hint #0x14 Which is a NOP if SOC does not understand this hint. It's being used here: http://lkml.iu.edu/hypermail/linux/kernel/1801.0/04191.html http://lkml.iu.edu/hypermail/linux/kernel/1801.0/04191.html and also here: https://github.com/ARM-software/speculation-barrier/blob/master/speculation_barrier.h https://github.com/ARM-software/speculation-barrier/blob/mas... (which is being upstreamed to compilers in cross-platform generic form IIRC) ARM whitepaper states that conditional selection/conditional move is enough on most ARM implementations. If it's not the case then the new CSDB solves the problem. On older CPUs it's still a NOP. X-Gene disables branch prediction: http://lkml.iu.edu/hypermail/linux/kernel/1801.2/06482.html http://lkml.iu.edu/hypermail/linux/kernel/1801.2/06482.html ThunderX2 branch prediction hardening: https://patchwork.kernel.org/patch/10151975/ https://patchwork.kernel.org/patch/10151975/
- readittwice 9y agoThanks for the nice writeup!
- bonzini 9y agoCSDB is for Spectre variant 1. The post is about variant 2.
- RobLach 9y agoThe new microcode from Intel and AMD adds three new features. The second (STIBP) protects a hyperthread sibling from following branch predictions which were learned on another sibling. Is this about threads in the context of SMT? I guess what I'm asking is "hyperthread" a thing outside of Intel marketing speak that warrants mentioning AMD?
- theevilsharpie 9y agoHyperthreading is Intel's implementation of SMT. However, since Intel was the only one doing SMT on x86 until very recently, hyperthreading has become the de facto generic name for it.
- RobLach 9y agoAh that makes sense. My last exposure to this space was IBM Power stuff and we were calling them sibling threads or side threads.
- AstralStorm 9y agoIn new AMD CPUs (Ryzen, Threadripper and EPYC) there are simultaneous multithreaded engines - core siblings, one per core, issuing is 2 extra instructions compared to Intel SMT 4.
- lovelearning 9y agoCan somebody here explain why Intel and kernel devs are still debating about solutions in late January? I haven't followed this stuff closely, but I was under the impression that Intel and others had been informed about these vulnerabilities 6 months ago and everybody had fixes ready by early January.
- gtirloni 9y agoBotched disclosure process. More details at the end here: http://www.daemonology.net/blog/2018-01-17-some-thoughts-on-spectre-and-meltdown.html http://www.daemonology.net/blog/2018-01-17-some-thoughts-on-...
- ustolemyname 9y agoHow do you mean? The formal disclosure was supposed to be earlier this month. [Edit] I see, link implies the problem is that the 6 month disclosure process lacked urgency, and many affected parties were notified late in the cycle. Perhaps this is an argument against agreements to keep vulnerabilities secret for a long time, as an attitude of, "there's enough time to address this," can be counterproductive.
- sschueller 9y agoI am sorry but after 6 months of Intel/AMD doing nothing I don't expect the Linux community or anyone else to keep their mouth shut. Also because of 5 days? Embargo was for the 9th of Jan. and it leaked on the 5th after 6 months! What are you going to do in 5 days that you didn't in the last 6 months.
- phire 9y agoThe botched embargo destroyed their chances of managing the PR like they thought they would be able to do. Intel thought they could roll Spector and Meltdown into a single massive bug, that all CPUs were vulnerable to. Instead, AMD leaked the fact that AMD CPUs didn't need the KPTI patch, which meant the very first thing people knew was "it's an Intel bug". This very much put the Intel PR effort on a back foot. Then Intel thought they could just release their microcode update (hell, they even coordinated with AMD to release the same microcode patches), and tell linux "here are the patches to use it, you must merge it". I assume the plan involved disclosing on the 9th and essentially bully Linus into merging the patches by the 10th. They wanted people to thank them for spending millions to develop the new microcode and once-and-for-all solving this problem. They wanted the headlines "Intel releases microcode which fixes Spectre/Meltdown flaw" so that people would stop demanding intel replaces their broken silicon. Then google releases details about their retpoline idea (I'm assuming it was developed not long before the embargo ended). It achieves the same thing, but with less performance penalty and no microcode update needed. So now the Linux mailing list has something to debate. The Intel engineers are very motivated to get their patches merged, because they spent millions developing that microcode and they want the PR wins for "fixing the problem". Watch how the immediately segway into "oh, but retpolines don't work on skylake" The Linux engineers are not happy with this, they are angry at Intel for being the source of the problem and probably see through Intel's little PR plan. They are triple checking intel's work and seeing if they can come up with an even better solution that works on skylake too.
- 6f666579 9y agoThis might be fundamentally irrelevant to this thread, but it got me wondering and I would like some assistance/guidance: Whenever I read the mailing list, or threads related to it, I don't understand 99% of the stuff. Do I need to know C _very well_? Do I need to be familiar with kernel? If so, how do I go about doing that? At the moment I'm reading "Code: The Hidden Language of Computer Hardware and Software".
- GuiA 9y agoWell, you’ll only understand 100% of it if you’re a kernel developer (and a good one at that). What’s your target? Knowing C and fundamentals of computer architecture + OS design probably gets you to 20-30%. Having spent a bit of time around the Linux kernel itself (writing extensions, drivers, read random blog posts, etc) might get you 60-70%, and so on. The book you’re reading is very good, your time probably isn’t wasted reading it.
- 6f666579 9y agoThanks! My object is actually merely to understand it myself. I'll stick to reading the book, and then finding a book on OS design etc. as the other commentators suggested.
- tarsinge 9y agoHaving a very good grasp on C (things like pointer arithmetic, bitwise operations, ...) is definitely a prerequisite
- gaius 9y agoRead Tanenbaum, take it from there
- 6f666579 9y agoThanks! I'll take a look at his book. You're talking about "MOS", right?
- 9y ago
- tinus_hn 9y ago> You might want this when running unrelated processes in userspace, for example. When are you not? Why have security and process isolation if all processes are considered related?
- tomalpha 9y agoYou might perhaps have a setup where trusted users are running trusted code, can guarantee* a lack of malicious intent, and primarily want the user-and-process-segregation system to prevent a single failure of a single process from affecting anyone else. You might conceivably have this in a corporate environment (I do). For the vast majority of systems that do run untrusted code, including web browsers, this mitigation is probably appropriate. Perhaps the word “might” here could be upgraded to “probably”? *for some arbitrary value of “guarantee”
- tinus_hn 9y agoSo you run everything as root, or your setup would work just as well if you did?
- sambe 9y agoHow is that comparable? Running everything as root is a) asking for accidents; b) a different class of problem.
- tomalpha 9y agoYou still want to run as a regular non-root user, possibly different users. The key difference to the mainstream use case is that you're looking to minimise the impact of bugs and failures, rather than manage security and combat malicious actors/code. For this particular use-case, you might well consider that you don't need to patch for meltdown and spectre given the perceived risk/performance tradeoff for the current patches.
- SolarNet 9y agoI think you misunderstand. The statement "when running unrelated processes in userspace" probably means, when running multiple threads under the same process id. Threads are "lightweight processes" in linux parlance (e.g. linux treats each "thread" as process, and then deals with the fact that some of them share memory). What they are saying is that this instruction is - for example - for a browser (a userspace process) to clear the branch prediction cache after running untrusted javascript on another thread.
- cthalupa 9y agoSo, the interesting thing here, to me, is this bit: >So now we mostly don't need IBRS. We build with retpoline, use IBPB on context switches/vmexit (which is in the first part of this patch series before IBRS is added), and we're safe. We even refactored the patch series to put retpoline first. Unless I'm reading this wrong, it looks like retpoline is not enough, and you still need the microcode updates from Intel or AMD that offer IBPB. If this is the case, why has Google been saying that retpoline is all we need?
- gavindean90 9y agoFrom what I can see, the retpoline works on pre Skylake processors. I am guessing that Google might not be using Skylake+ processors and so their comments are not wrong for their equipment.
- cthalupa 9y agoNo, it's pretty specifically not about the Skylake issue - The retpoline not working on Skylake is fixed by IBRS, and is due to ret calls falling back to indirect prediction in deep stacks. vmexits and context switches are a very different thing than the deep stack ret calls.
- compuguy 9y agoI swore that Intel had recalled the microcode updates because of issues (I've not had any of note)? https://www.computerworld.com/article/3250297/microsoft-windows/let-the-biosuefi-firmware-recall-begin.html https://www.computerworld.com/article/3250297/microsoft-wind...