735 points · by superkuh · 5y ago · 469 comments
[1] https://www.phoronix.com/scan.php?page=news_item&px=Spectre-....
My gaming PC, a Sandy Bridge i7-2600k, has had 20 microcode updates between 2010 to 2019. The majority were in 2013 until the spectre mitigations came in 2018. The last bios update for my mobo contains microcode 2 versions behind the spectre updates.
Feed a BIOS image in to this tool to view microcode information. https://github.com/platomav/MCExtractor
I know this way of disabling mitigations on Linux (nevertheless thank you, I well might be unaware of this feature, I only learnt it some years ago).
However, I doubt you can disable microcode-level mitigations this way. I believe it only affects the kernel level.
[0] https://wiki.archlinux.org/title/Microcode#Early_loading
No. If it wasn't impossible, it would add a massive delay to context switches between processes as the required microcode changes are applied.
This is not as sure a deduction as it once was.
The main reason for games not to be playable on Linux is the anticheat software used in modern online games. Pretty much everything else will now run perfectly (see protondb.com). Since the commentor you were replying to specified that they played old single player games they would probably be fine with just Linux. Indeed many sufficiently old Windows games are now easier to play on Linux than they are on modern Windows.
The Linux kernel mitigations can be disabled easily. But with microcode this is the problem with having it as an opaque blob. You have no idea what's in that update. Maybe it's good for you, maybe it's bad.
But I do think software engineers should agree that updates should always be reversible. And security updates should always be backported yet still reversible.
This means getting security updates without feature updates, doesn't it? But this time we want feature updates without a security update.
I have to replace my computer every several years due to performance degradation, even though my workflow has remained the same for over a decade. Even editing simple text documents has become painfully slow on my 2013 Macbook Pro.
M1 gives me a few years breathing space, hopefully, but I'm sure it won't be able to open a 1KB text file instantaneously in 5 years.
But it won't work now, because the whole stack is probably too inefficient.
A world where software can barely fit in a single machine and can only scale up. In many cases, this software doesn't even do anything that is functionally different from 10 or 20 years ago, but it still consumes many more resources.
A world where some websites still don't work properly across web browsers. Electron apps which should enable easier cross platform applications, don't (e.g. Microsoft Teams doesn't have feature or even UI parity in windows and linux).
A world where clean code destroys performance, because the time of developers must be paid for by the company, but the costs of resource wastage are externalized. And there isn't even any evidence that these practices actually help to do what they are supposed to do!
It ran great with a few optimisations (or more specifically, removal of some really dumb code).
It seemed really obvious to me to ensure it would run well on a broad array of old hardware, and I suspect this is because of all the time spent on OCAU as a teenager trying to get the cheapest hardware possible to play the latest games.
Ecology.
A lot of the older computers were awfully power-inefficient (and also emit a lot of heat).
So IMO we should replace "Pentium 4" in your statement with something like "Celeron J4115", or some of the Atom CPUs, maybe?
-O0 -fsanitize=address -fsanitize=undefined
And things have to stay instantSo far that has reliably meant that the software is useable on e.g. a raspberry pi 3.
Alternatively, on Linux you can limit the maximum CPU frequency with something like
FREQ=800000 # 800 MHz
for i in /sys/devices/system/cpu/cpu[0-9]*; do
echo $FREQ > "$i/cpufreq/scaling_max_freq"
done/s
Not such a good choice. It was kind of a "strung out" processor, with an overly deep pipeline, plus there was that RDRAM business...
I'd say maybe an Intel Pentium III coppermine, or maybe go AMD and choose the original Athlon.
> I only say this half-seriously
Why just half-seriously? Make it totally serious.
> If it's unusable, go back and optimize some more.
That too, but even more than that: Go back and make more initialization lazy; make sure your UI isn't overly de-prioritized in favor of other work; and make sure you have logic and UI for when certain thing take time, allowing them to still carry out some activity while waiting.
Problem is that then AVX became a common thing (at least in part of what I run) so that processor became unusable. I moved to an i3-3120m, which supports AVX, but then AVX2 became a thing.
I could've gone for a 4000-series i3 at that point, but I just grew tired. And Pentium/Celerons are a bigger mess to find because some of them are Atoms now. For example, I have a N4000 sub-notebook that I got for my mom to check her email and view online videos, and the things feels pretty snappy for those things. But then you try to run some numerical code and you find it's 50-100x slower than their bigger siblings... Turns out it has no AVX of any kind, and event though it says it supports SSE4, it feels possibly slower than the older Pentium I mentioned at the start, even with faster, dual-channel memory, and those old Intel didn't even have SSE4, just SSE3. But possibly at that point the 35W thermal headroom of theT5600 plays a big part as the N4000 is passively cooled and has a 6W TDP.
Moral of the story? Even if you try to, it's hard to pick a slow/old processor that will support all the operations that your software could use. Some of the give a huge speedup. You have to pick your battles. You'd probably have an easier time underclocking a lot out of your current processor (and disabling a few things?) and call it a day for performance testing.
The condition that the software has to be able to run on a Pentium 4 makes quite some performance optimizations impossible.
One trend at my company is to have microservices, where a single app is "single function" and uses a LOT of network traffic to talk to other "single function" applications.
However, on my beefy i9 work laptop I need to use Microsoft Teams and also Docker, which means the fan is on half the time and the computer can barely keep up with the workload.
I've seriously considering asking for another computer just to run Teams.
I wish I could use Windows XP with up-to-date hardware support and security updates, too. I remember the days of requiring on 300MHz core, 64MB of ram and 1GB of hard disk for the same functionality that Win10 now provides in a worse way.
I just installed Linux Mint on my 2013 MacBook Air, and now it's fast enough that you wouldn't know it's an old computer. Really amazing, it seems like Mac OS in particular is just super resource heavy. I realize Linux pretty much defeats the purpose of owning a Mac, but I'm just glad not to have to throw out an old computer that has seen me through my entire career shift into programming so far.
Linux absolutely flies on a Ryzen 4700U with an NVMe SSD. ^_^
And yet somehow opening a text file is as slow if not slower.
I've been happily using non bloated tools for years now.
Obviously this isn't for everyone. ;)
Unless you decide to switch to a modern console-based text editor. It doesn't have to be vim or emacs. There are many other alternatives. One new such (written-in-Rust) editor being Iota: https://github.com/gchp/iota
Usually I just go for Vim, but sometimes I need something else and in those cases I want to avoid heavyweights like VS Code.
40 years ago writing code was a lot harder; improving that has allowed a lot more interesting things to be built (both bc people can work faster and at higher levels of abstraction and because development is more democratic, leading to a wider pool of people writing things). The cost has been high though; few people think about the hardware and even the term “bare iron” is used unironically to refer to a machine running a multi-tasking OS!
But I think this will swing back the other way. Not by removing the abstraction but by “melting” some of the abstraction implementation layers. Hard work on improving interpreters and compilers has always been one of the ways, but assembly-optimized hotspots and tighter integration in some of the stack elements will be increasingly worth doing because fixing that speeds up all the developers working at higher levels.
The downside is that you won’t be able to, say, easily customize that version of React you’re deploying. But nowadays you really want to stay away from that anyway, in 99.99% of cases.
So bake those supply chain vulnerabilities right in there, nice and deep.
When you load 50 (or for the tree, 500) independently developed modules the probability of failure (or vulnerability) is typically the sum, not product, of the failure probability of each component. The same reason why not everything is implemented as a fleet of microservices.
Few worry that the TCP implementation in your OS is a monolith, and one that is tightly integrated with the IP code. This will make increasing sense further up the stack, for good or ill.
There are trade offs both ways.
That's not even including the fact that processors are actually processor simulators these days.
Thus, "bare metal" is actually "resource division among managed processes on a simulated processor" which sure sounds a lot like a VM to me. Modern OSs are in fact a form of virtual machine, and we found it useful to have yet another.
Arguably docker type of simulation introduces yet another level so a react app in a docker shell in a VM cluster is really a interpreted application on a simulated operating system, on a resource sharing virtual machine, on a virtualized hardware environment, on a multitasking virtual machine, running on a simulated processor that's implemented on a _real processor_.
If you write a program that is launched by an OS you are by definition not manipulating the hardware directly. Those POSIX calls go somewhere.
I write such code from time to time: a boot loader, a small OS, or apps that run with no OS at all.
not every programmer think this is fun. Some programmers prefer to code up features, rather than learn or test out esoteric ways to micro-optimize.
AKA Less's law
I think both are true.
ARM: https://developer.arm.com/support/arm-security-updates/specu...
There are also a bunch of mitigations for AMD.
FTFY
Look at the prices of graphics cards. Or, nowadays, hard drives thanks to Chia. It's going to be a goddamn tragedy for the entire planet if Chia continues to grow in popularity.
Similarly, when a new browser update goes out it may or may not make all the web apps you rely on slower (or break them), so any web benchmarking also needs to be re-run from scratch on a regular basis. New Chrome and Firefox releases "ride the trains" every 6 weeks or so, and they quietly push changes to the browser more frequently than that which can occasionally impact perf or behavior too.
"Security by default" affects, by default, also trusted workloads. Games, desktop editing software, word processors, spreadsheets running dumb totals in big tables, and virtualized computing workloads running in the cloud (where it has a serious financial impact for whoever pays the cloud bill). All of them pay the Javascript tax. Worse, there doesn't seem to be any solution in sight, we have become too reliant on the damn thing.
as trusted workloads?
The problem is the obvious solution - get rid of the hostile programs! [i.e. removing the capability of any website to run code from anywhere on your machine] - has been ruled out from the start. Now we are only left with non-obvious solutions and bad trade-offs. Things like CPUs with fast/slow microarchitectures on the same die so you may run the JS engine on a slow core that has a harder time messing with things, for example. How many engineer-millenia are poured into trying to make this work?
Has it even been tried? Given that we do need to protect against info disclosure vulns, even a rough attempt at proper MLS would be way more feasible than treating all programs as untrusted/hostile or all data as equally sensitive.
If one could get rid of the hostile people, we wouldn't need passwords. Login is enough. Much easier to develop webapps. But we can't get rid of the hostile people and we can't get rid of the hostile programs.
The only semi-successful way to get rid of the hostile programs is Apple-style walled garden. But even there malware happened. And giving up all your freedom for that kind of safety is like going to the jail voluntarily to be safe from the outer world. I don't think that this approach would work for everyone.
- M1 machines are 'closed' because of Apple and not because of the CPU architecture. They could adopt RISC-V and the GPU and drivers would still be closed etc.
- M1 is fast because Apple have invested a lot in building an outstanding CPU design team and the economics of their business allow them to fabricate on the latest TSMC node.
- Apple could have locked down the M1 machines much more completely than they have done.
If you want fast 'open' systems you need to work out how to incentivise firms to build systems in this way. RISC-V will not magically get there on its own because its a more 'open' ISA than ARM. In the meantime credit to those who are working out how to get the most out of the M1.
Others have documented the engineering that went into a new boot system for the M1 to make multi-boot and custom kernels possible. Engineering that would be pointless if no one were expected to use it.
What law? They locked down iPhone and law does not care. How is it different for Mac? The could've locked down their M1 Macs, but they deliberately chose not to.
Today it's an average expensive chip, tomorrow it's below average. It's really hard to keep up with the world.
After all an optimisation is designed to alter the timing. If all actions must have the same timing, optimisations fail.
Do we simply offload any sesnitive processing to specialised chips? The silicon wafer seems to be developing vulnerablities like a network.
Years ago, I remember reading Itanium stalled because writing compilers to ably support speculative instructions was hard or simply impossible.
Luckily, we only need this for untrusted code. What really peaves me is that trusted code is now having to run slower as well.
I don't like that everything has to get 25% slower because your SSL session setup needs to be protected.
But then again, browser exploits have been a thing forever. I expect that something bad will happen to my computer if I'm visiting shady websites.
So my question is: are shady websites _more_ dangerous now that these side channel attacks have been discovered? (serious question.)
Supply chain attacks exploit that fact that far too much code is inappropriately trusted.
Realistically though, most userland software falls into that category nowadays:
- JS-driven web apps like GSuite
- Sandboxed "App Store" apps on mobile and even desktop
- Potentially any other desktop app that is exposed to content originating from the web or email (e.g. Acrobat, desktop Office, etc.)
I wonder if security models need to become less black-and-white, with a middle tier of trust for apps or domain names that should still be sandboxed but are trusted enough that we're willing to trade some risk of timing exploits for improved performance?
I'm reverse engineering the Apple M1 and haven't found any trustability issues yet (besides the proprietary early stage bootloaders, but everything has that). There are some 12 or so coprocessors running proprietary firmware, but all of them are safely behind OS-controlled IOMMUs and not privileged to take over the system. There is no ME, no SMM, no TrustZone, nothing running with higher privilege than the OS. Most of the coprocessors have at least inspectable firmware (except the Secure Enclave, but you can just turn it off). The ARM architecture design makes it near impossible for an early boot backdoor to, say, run your OS in an undetectable VM too. No updatable microcode.
On x86 you have the ME running secret code with higher privilege than the main CPU, as well as SMM running secret code on the main CPU at a higher privilege than the OS and stealing cycles from it, as well as a rather poor track record of proper IOMMU sandboxing (especially for anything that isn't a PCI device), and secret, encrypted microcode updates.
... except for assuming "EL3 seems to be missing" means "EL3 doesn't exist" instead of "the bootrom dropped to EL2 before we got control".
Not saying I have any evidence to the contrary, nor is this in any way a criticism of your awesome work. Just saying that this will unfortunately remain forever unknowable unless Apple decides to volunteer information.
Personally, if I were Apple, instead of removing EL3 I would've left it in but unused, accessible only to code signed by Apple with the public key burned into silicon. As a way to mitigate currently-undiscovered silicon bugs.
Your argument is equivalent to "Apple might have backdoored the CPU". Well, yes. So might have every other CPU vendor.
If EL3 were to exist, for starters, it would have no way to receive interrupts, as Apple uses both IRQ and FIQ for the OS (normally FIQ is used for EL3 on platforms with a secure monitor).
Can you explain this? It doesn’t sound right.
Well, not secret if running coreboot… I'm not sure if coreboot's SMM handler might call into FSP/AGESA though.
You jest but…..
But partially because you like money and can make it exist pretty easily and cheaply
Would perhaps a solution to this be to have mixed cores: some cores intended for managing passwords and other secure data with all the performance reducing mitigations to avoid timing attacks. Other cores completely unlocked, no mitigations, and intended for non-secure computation (gaming, number crunching, ...).
Then let the OS and programmers ensure it's known which computation is marked as secure and which is not, to decide on which cores it can be ran.
Even if you figure out how to do it though, you can still fall to a double failure: your safe code doesn't leak passwords via a timing attack, but via something else (buffer overflow?) it leaks the password to the unsafe side, which in turn leaks it via a timing attack.
Applying the patch should be opt-in if you ask me. But of course, most sysadmins are hopeless. So then the OS vendors push it out, it's safer than letting the decision to uninformed people.
Sysadmins/DevOps/SREs aren't hopeless, they just have different incentives and responsibilities. Default secure with the option to let down your guard when the need is there is always always the right choice. You wouldn't have your firewall default allow with a blocklist. You wouldn't grant everyone sudo access and then maintain a list of commands they can't execute. Such a thing is impossible to maintain.
For me specifically I manage too many servers to bother with this. It's going to be deployed to everything without exception and if you need more performance we'll rack more hardware. The cost of more CPUs is less than the risk that something will slip through the cracks. I don't care that your pet service doesn't execute any untrusted code, I'm not carving out exceptions when I have 20 teams constantly asking for stuff.
Sounds like your IT department is severely understaffed and is unable to meet the needs of the developers without reducing service.
> but that analysis is nearly impossible an filled
Like could we just not use the browser's password manager or use a separate browser for sensitive websites (eg banking)?
That's like Ford selling a truck with 500hp and then later recalling it to detune it to 400hp. The truck I have is no longer the truck I wanted or the truck I paid for. Ford owes me what it said on the label.
What if Intel wanted to sandbag existing products to promote new ones?
So pardon me, but from a lifelong AMD enthusiast, you all deserve this...
"Hey guys, why are you still running Intel? That shit is like 2 generations behind my AMD in performance and reliability."
Damn, that felt good.
Also why would you be a life long enthusiast of a specific company? Why not buy what works best at any point in time?
https://en.wikipedia.org/wiki/Electromigration
It takes on the order of 100 years for well made modern CPUs to fail due to these effects, but poorly made CPUs could fail far earlier. There are likely some nonzero number of failures attributable to electromigration.
There are some people who buy overclockable parts and don't overclock them because they are more robust. It's unknown exactly how or why CPUs fail. Taking them apart to check is an extremely expensive endeavor. But sometimes they do.
Where is the evidence that AMD is more 'more reliable' than Intel?
But in any case, if you have one chip that decreases in performance 10% per year due to security mitigations and another chip that remains consistently performant, it is something to consider when shopping.
Also, AMD almost lost everything. At one point they had to sell their own HQ and lease it back to generate cashflow and keep the doors open.
If they had closed, Intel research budgets would tank. They wouldn't have nearly as much incentive to innovate. Without Dodge motor company you would still be driving a Ford Model T in black.
If AMD died instead of making the original Athlon, you would still be stuck with a Pentium MMX because Intel could have stopped innovating and kept their market share.
Based on the Intel microcode release note [1] it doesn't seem like client HSW got any update this time, only HSX (Haswell Xeon).
---
[1] https://github.com/intel/Intel-Linux-Processor-Microcode-Dat...
Is that microcode fix somehow better than mitigations in the kernel?
I wonder if it will allow AMD to catch up even further (even though AMD CPU were also affected).
That said, I don't think this is related to any of the named Spectre variants.
The container hasn't been rebuilt in many months (like 7) and the only thing that has changed on the machine is CentOS updates.
So... why not with CPUs?
The remedy for an entire industry's product performing to a degree less than advertised is a class action lawsuit (good luck getting more than about five dollars for something like this), not returning the products for a refund.
As someone said below (maybe after you posted)
> Then with that money I can do whatever I want... eg. buy an AMD washing machine... or generally a newer, faster one, becuase some time has gone by. Or go on a vacation. Or drugs and prostitutes.
The other options here are "Well, I'll just not have a washing machine". Which you can do, but it will take more time to clean your clothes and cost more money after not very many washes at all (or you hand-wash, but then you're looking at 10x as long). Same for computers -- if simply not having one is an option for you, you probably haven't noticed the degradation.
- keep the old "firmware", and risk the machine catching fire
- put the new firmware on, and make it wash slower
Yeah... I'll choose returning it to the store.
Or perhaps more accurately, someone spoiling your clothes by putting a dye in their pocket and letting you wash it in the same batch.
The problem isn't that they made the patch, it's that they made a defective part in the first place. The patch just fails to cure the fact that they made a defective part.
The problem, IMO, is that a manufacturer of a high-quality washing machine has the human ability to go through and engineer out or (or economize in) every conceivable failure mode. There's no need to issue updates, because it only does the specific behaviors that it was designed to do. Each part has a wear characteristic, can corrode, can be mechanically stressed...but a pressed sheet metal bracket is fundamentally always going to be a bracket, either it corrodes, or wears, or yields, or it doesn't, or else it holds the things it's supposed to hold, there's just not that many ways in which the performance of a bracket can surprise the designer. The owner's manual says it's to be transported carefully, installed on a flat surface indoors, plumbed to water/wired to 120VAC/drained through a standpipe, and then you operate it by adding clothes and turning the knob. It's a fixed-purpose washing machine, that's what it does.
In contrast, Intel employed very smart, hardworking designers to write the microcode and HDL that describe the `vmovdqu YMMWORD PTR [rax], ymm1` assembly instruction, they thought about what that meant, what side effects it could have, why it should do what it does, and they probably were quite pleased when they optimized it to be faster when doing zero stores. But while the hypothetical ME for our washing machine could probably comprehend every requirement for the bracket, the Intel designers didn't build a fixed-purpose machine, they built a general-purpose machine that runs both trusted and untrusted code of unknown, highly flexible contents. The state machine describing all possible results of a Turing complete processor even with storage limited to mere gigabytes instead of an infinite tape, is unimaginably large. I maintain that numbers over a few thousand are humanly impossible to fully imagine, but to put it in concrete terms, worldwide, literally every second on the order of 10^20 novel combinations of 64 bit instructions are executed by a CPU, and every second, millions of programmers and computer users are generating never-before-seen demands of the hardwrae.
It's impossible to predict every side effect of every combination of instructions a CPU will run. Meanwhile, the brackets are simple brackets, handing the same requirements and performing the same functions that the designer should have known about when they designed it.
What CPU are you replacing it with? Most if not all modern CPUs are vulnerable to this so changing it makes little sense. Even if you can change it, you'd need to switch motherboard as well.
Then with that money I can do whatever I want... eg. buy an AMD washing machine... or generally a newer, faster one, becuase some time has gone by. Or go on a vacation. Or drugs and prostitutes.
We wouldn't accept that on any generic customer product. We'd recall whole fleet of cars if they had severe flaws that directly affect their performance.
There might not be viable alternatives, but there should be at least something from CPU makers to help swallow the pill.
No one gave you a guarantee that “there will never be any security issues with this product and if there are, mitigations will cause no performance degradation”.
If you want that promise you’re gonna have to pay for it, man. And it’s not gonna be a flat fee. That’s an insurance model.
We expect that this issue will be sorted out soon.
In the meantime we hope you'll consider that speed and security are sometimes traded off, in this world of network-aware, gigahertz speed washing machines which you can also use to do banking, create spreadsheets and watch your favorite movies.
Just a note that the title should be:
Your CPU May Have Slowed Down on Wednesday
bug*
feature*
(bug*)
See, we can also play that bait game
Last laptop I bought the missus at xmas was a Ryzen 4000 and that thing screams performance wise, incredible for 800 quid.
I have a Zen 2 box which I'm just starting to learn about.
> Clickbait is a text or a thumbnail link that is designed to attract attention and to entice users to follow that link and read, view, or listen to the linked piece of online content, with a defining characteristic of being deceptive, typically sensationalized or misleading. A "teaser" aims to exploit the "curiosity gap", providing just enough information to make readers of news websites curious, but not enough to satisfy their curiosity without clicking through to the linked content. Click-bait headlines add an element of dishonesty, using enticements that do not accurately reflect the content being delivered.
I don’t feel this applies in this case because it fails to be deceptive, misleading or dishonest. (Parts of the definition certainly apply, but not enough.)
Sure, you could have a title like “Intel just slowed down their CPUs with a microcode update” (and I do prefer explicit titles like this—you should see the titles I write myself, 70- and 80-character limits severely cramp my style), but the article’s title isn’t particularly bad.
Effective but unethical, but unethical in the sense that marketing psychology is unethical.
Unethical because it uses well known human psychological weaknesses to help nudge a target towards an action that they themselves may not have chosen to perform without the nudge.
If I was asked, i'd wager that most motivated persuasion is unethical to some degree.
Instead, the title should just state what is the case: "Intel CPU-update causes slowdown" or something like that.
Imply one thing, deliver another and this leaves an aftertaste even the actual content is good (like in your case).
Perhaps there is an MSR bit you can flip to set the behavior back to the old way, but none has emerged so far.
Might want to look for them here: https://github.com/intel/Intel-Linux-Processor-Microcode-Dat...
As to how to actually use those files to get your "intel-ucode.img", just take a look at: https://archlinux.org/packages/extra/any/intel-ucode/
For the "iucode_tool": https://gitlab.com/iucode-tool/iucode-tool/-/wikis/home
The actual PKGBUILD for it on Arch Linux: https://github.com/archlinux/svntogit-packages/blob/packages...
---
cd Intel-Linux-Processor-Microcode-Data-Files-microcode-${pkgver/./}
rm -f intel-ucode{,-with-caveats}/list
mkdir -p kernel/x86/microcode
iucode_tool --write-earlyfw=intel-ucode.img intel-ucode{,-with-caveats}/
The above gives you "intel-ucode.img". Copy it to "/boot/". Run "mkinitcpio -p linux" or the like.First you kill AMD with "efficiency". Then you "encourage" users to upgrade, since secutity updates make this efficiency disappear.
How is this even legal.