Meltdown and Spectre Linux kernel status
kroah.com
kroah.com
1. They will have bugs. There's a reason PTI was heavily modified from the old KAISER code. They will also tend to diverge from upstream just because the code is so different. This means that the next time low-level x86 changes need to be backported, it'll be a huge mess.
2. There is only minimal upstream support. I, for example, am already largely ignoring two bugs in the backports that aren't in the upstream version. Why? Because I have no affiliation with a distro using an old kernel.
3. Contrary to its marketing, KAISER does not effectively mitigate the old kASLR leaks. PTI very nearly does, and I intend to improve it further once I find some time to do so. I doubt those improvements will get backported to pre-4.14 kernels.
4. At least some versions of "KAISER", on meltdown-affected hardware, expose the kernel stack to userspace. If that's not usable for rooting a box, I'll eat my hat. KPTI doesn't have this problem.
If you can put pressure on your organization or suppliers to update to 4.14 or better, please do so. Red Hat, especially, should seriously consider moving to 4.14 for RHEL 8.
Am I right in assuming that Red Hat built their own mitigations, independently from upstream?
And that made me asking how Red Hat (and the free derivative CentOS) could have already patched their current kernel (on Jan 4th) while the patch was still being discussed on kernel ML the same day?
I don't see how they could come up with new kernel with mitigation for the three variants, excellent KB articles on the CVEs, tunables flag, preliminary performance test, etc. without having already patches implemented and tested for some time.
Do they have internal kernel devs? And so, do Redhat have another implementation?
(This is my first comment on HN, I hope I'm following adequately the guidelines)
Typically, a sensitive issue will be disclosed privately, and devs for various groups will share progress privately. Then ideally, all distros will have patches and documentation ready on the agreed date of public disclosure.
See:
So you can be assured that Red Hat coordinates with upstream. It also has a serious "Upstream First" policy (with sensible exceptions, of course).
As to whether Red Hat has kernel developers, of course it does. :-) Much of Red Hat's popularly began as a Linux distribution. If you're curious, the LWN publishes statistics about who contributes to the Linux kernel, and the most recent one is for the 4.11 development cycle -- https://lwn.net/Articles/720336/
(Disclosure: /me is a Red Hatter.)
And, correct me if I'm wrong, but apparently calling Linus Torvalds and Greg KH the general public (as far as Spectre and its (poor for now) mitigations are concerned) is the new norm. I'm not sure of what the community will think of that. And of the corporate actors involved in that curious choice.
The problem here was that discussion was confined within company barriers (with small occasional exceptions) until last Wednesday. Linux thrives because it is based on reaching consensus among all stakeholders, and not being able to discuss the approach to take with respect to Spectre directly resulted in chaos.
I am very happy with the work that we at Red Hat did on this project (though of course not perfect in any way!) and I am proud that our articles are published openly and are being widely shared among the Linux user community at large. However, I certainly would have preferred to work together with all other vendors on a common solution before. But unfortunately, even if (as is the case with Red Hat) upper management is extremely supportive of upstream collaboration, you do what you can.
* http://www.theregister.co.uk/2018/01/04/intel_meltdown_spect...
See also these:
In this particular case, most of the fix had to be done in the operating system (the new microcode only enabled extra functionality needed by part of the operating system fixes), so it makes sense that operating system developers were allowed (and required) to prepare in advance. The three most relevant operating systems are Windows, OSX, and Linux; for Linux, one of the most important distributors is Red Hat. That gives two of the groups which were notified in advance: hardware (Intel, AMD, ARM) and operating systems (Microsoft, Apple, Red Hat, a few others).
This is not to diminish the work done upstream by less independent people. Dave Hansen, in particular, is the one who actually got the code to function.
The Spectre mitigation is expected soon but there is no ETA on Meltdown yet: https://www.reddit.com/r/freebsd/comments/7och5a/freebsd_was...
As others say, OpenBSD indeed violated embargoes a few times.
It's similar to the Recalls of Takanas airbags in this regard. The manufacturers are informed and they tell us the consumer to bring in our cars. I'm not qualified to replace an explosive airbag, even though I drive a car daily as a lay person.
Imagine how it would work out in your airbag analogy if only Toyota and GM knew, and they withheld information for months while they worked on their own fixes, meanwhile the public remains in danger and other automakers have no chance to implement their own recall plans.
I think we can say that Red Hat does have its own implementation for now.
edit : formatting
I'm looking forward to that story.
Will the OS/microcode update still at least partially protect me or will I have to be super-paranoid about apps and javascript for the remainder of this machine's life?
BTW, my machine is just a normal desktop/laptop, so no server stuff running or expected.
So that's a bit alarming for me since at least one of my several workstations is using a 5+ year old desktop board (an Intel board, ironically) that has been end-of-lifed according to its BIOS downloads support page. Meanwhile, some of the bigger server motherboard vendors (e.g., SuperMicro) are not yet prepared to supply firmware updates for recent motherboards.
Recognizing that the operating system vendors/maintainers are not responsible for our systems' BIOS and hardware, the flippant advice to "talk with your device's vendor" gives me a sinking feeling. (E.g., Microsoft: "Consult with the device manufacturer about the firmware version that has the appropriate update for your CPU.") As a technical person, I am going to find it difficult to bring all of my hardware—especially the older hardware—up to snuff for coping with these vulnerabilities. I fear for people who are less technically inclined.
One of the Spectre variants. The other isn't mitigated by it and will require an lfence on your sensitive areas of apps.
No OS or Firmware update will fully fix Spectre.
All applications that interpret untrusted code (such as Web browsers) also have to be patched.
https://gist.github.com/woachk/2f86755260f2fee1baf71c90cd653...
Buy stock in Gigabyte, MSI, etc.
https://wiki.archlinux.org/index.php/microcode
https://wiki.debian.org/Microcode
Also, directly from Intel:
While the regular approach to getting this microcode update is via a BIOS update, Intel realizes that this can be an administrative hassle. The Linux operating system has a mechanism to update the microcode after booting. For example, this file will be used by the operating system mechanism if the file is placed in the /etc/firmware directory of the Linux system.
Source: https://downloadcenter.intel.com/download/27337/Linux-Proces...
Apple probably delivers them through EFI updates, but of course, getting updated EFI firmware from Apple was never a problem.
You'll still be vulnerable, it'll just add another layer of difficulty to the exploit.
Firmware updates are largely irrelevant to this issue, only being involved in the sense that one way to perform microcode updates is for your machine's firmware to upload the new microcode image file. But that is just one way for that to be done; your operating system can do it, too.
* http://inertiawar.com/microcode/
* https://news.ycombinator.com/item?id=16081366
* https://newsroom.intel.com/wp-content/uploads/sites/11/2018/... (https://news.ycombinator.com/item?id=16079910)
The question is, how can one check if the CPU already got the microcode update?
Can a OS running inside a VM (over Intel VT ring-1) patch the CPU's microcode? (e.g. Linux host, and Win guest patches CPU's microcode) Nothing seems impossible anymore.
EDIT: however for some rare features, it is preferable to have them loaded by the firmware. I don't know if this is the case here.
Of all of my computers only one has been issued a BIOS update so far. I ran the PowerShell script before and after installing the BIOS. Installing the BIOS flipped the status of the fix for CVE-2017-5715 to on.
I also ran the free HwInfo utility that will show the microcode revision before and after installing the Windows update and before and after installing the BIOS. It only ever changed with the BIOS update.
I hope this changes and Windows does start updating CPU microcode. I also have a few older motherboard's that aren't likely to ever see a BIOS update again.
Do note that Microsoft appears to have updated their doc in the last day or so. They are now saying that three registry settings need to be set (instead of 2 previously).
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverride /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverrideMask /t REG_DWORD /d 3 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization" /v MinVmVersionForCpuBasedMitigations /t REG_SZ /d "1.0" /f
Some quick Googling seems to indicate that Windows has the ability to update microcode.http://forum.notebookreview.com/threads/how-to-update-microc...
Maybe this will happen with a later update from Microsoft as I'm doubtful that BIOS updates will happen with at least one of my systems.
The Intel[2] and AMD[3] microcode can be downloaded but I can't vouch for how many Meltdown/Spectre mitigations these versions contain. The Intel one is dated 2017-11-17.
[1] https://labs.vmware.com/flings/vmware-cpu-microcode-update-d...
[2] https://downloadcenter.intel.com/download/27337/Linux-Proces...
[3] https://git.kernel.org/pub/scm/linux/kernel/git/firmware/lin...
For LINUX (and probably BSD/etc users):
https://wiki.archlinux.org/index.php/microcode#Enabling_Inte...
Your distribution probably has a firmware package that has this bootloader stub. It applies the latest microcode updates just before your OS actually begins starting up (but for Linux after the Kernel has initialized things and is preparing to hand off to the initrd).
Yes, this is something that needs to happen at every boot; they don't get burned in to the CPU.
Does that fully protect my unpatched AWS instances from this CPU-level issues?
If not, is there any way to protect my AWS instance from a rogue unpatched attacker instance running on the same hypervisor?
In other words, with the current CPUs deployed at AWS, will it be possible for an attacker to simply launch an unpatched instance to steal data from other instances (patched or not) running on the same AWS hypervisor?
I hope not, because the cloud multi-tenant model would be effectively dead until AWS hosts with unaffected CPUs are available.
Quick sketch: disable EPT and go back to shadow paging. Maintain a third page table with any kernel pages unmapped. Invisibly swap between on syscalls.
Of course, the microcode updates are meaningless without the corresponding kernel patches, but apparently only RHEL and SLES were deemed worthy of receiving those ahead of time, having already rolled them out while Linus and co are left scrambling to integrate the IBRS and retpoline code dumps after the fact.
[1] https://tracker.debian.org/news/899110 [2] https://downloadcenter.intel.com/download/27337/Linux-Proces...
I flashed my Skylake laptop a few days ago, and now I'm on microcode rev 0xc2 (versus 0xba in the latest Intel tarball). CPUID output suggests IBRS support (according to [1]).
* http://lists.dragonflybsd.org/pipermail/users/2018-January/3... (https://news.ycombinator.com/item?id=16084641)
* https://medium.com/@frankycaron/this-week-in-words-the-langu... (https://news.ycombinator.com/item?id=16075588)
* http://www.theregister.co.uk/2018/01/04/intel_meltdown_spect...
One of them you might have expected to use the word "fuck", but actually did not. (-:
* https://lkml.org/lkml/2018/1/3/797 (https://news.ycombinator.com/item?id=16066968)
In part, this was down to the cat being let out of the bag early.
Or it can be simply someone that noticed this unusual sale, and saw the circumstances ripe for a bit of naked shorting.
In other words, if something would need 500 picoseconds you have bit 1, if it is 250 picoseconds instead it is bit 0 (numbers pulled out of thin air).
This is made possible because processors execute the read speculatively even if it is actually forbidden. This read causes a cache hit. Of course the read is never brought into effect because first it is forbidden and second it is in a branch which will never be executed. At the time of the speculative read the CPU seems not to have enough information to know not to execute that read. Even speculatively.
And that speculative read has a side effect on the cache which is measured by the exploit.
Of course the read is never made visible to the process because later the CPU knows not to bring it into effect. However then it is too late: there is measurable difference in caching times.
Did I understand the way of the attack correctly?
* https://www.raspberrypi.org/blog/why-raspberry-pi-isnt-vulne... (https://news.ycombinator.com/item?id=16080002)
* https://dev.to/isaacandsuch/how-meltdown-works-28j2 (https://news.ycombinator.com/item?id=16085592)
One of the other problems is tricking the branch predictor into speculatively jumping into code of one's choosing.
* https://newsroom.intel.com/wp-content/uploads/sites/11/2018/... (https://news.ycombinator.com/item?id=16079910)
But to read the data one still must use timing attacks, no?
It is also worth understanding the differences between Spectre and Meltdown, since they are distinct. Spectre refers to reading process memory via measuring cache timing after speculative execution. Meltdown, in conjunction, refers to the fact that Intel CPUs do not verify access rights to a virtual address until after the speculative execution (and thus the cache hit) takes place. Meltdown allows bypassing page permissions so you can read any page mapped in your virtual address space. Spectre is 'limited' to only reading addresses you already have access too.
Meltdown is the most expensive perf wise, but more straight forward to fix. Processes can only access addresses mapped in their address space, so if you in unmap the kernel while a user process is running then they can't read it. This is expensive because every syscall now flushes the TLB due to changing the page table, so page accesses are in general slower.
Spectre is more complicated to fix. One part of the fix is the retpoline hack that basically attempts to defeat the branch predictor through clever code. It looks like the CPUs are also getting microcode update to allow it to disable the branch predictor in some situations.
So, if you are running a (still supported) Debian Jessie a simple apt-get upgrade isn't gonna cut it:-(
* https://lists.debian.org/debian-security-announce/2018/msg00... (https://news.ycombinator.com/item?id=16076175)
It's not the only operating system where the process is slightly more complex than a kernel update. Windows NT updates require the coöperation of other softwares on one's machine. (-:
I just did the apt-get update; apt-get upgrade dance in a hurry yesterday and thought I might be good. My post was more a reminder to everyone not be lulled into a false sense of security...
> For the oldstable distribution (jessie), this problem will be fixed in a separate update.
You can check https://security-tracker.debian.org/tracker/CVE-2017-5754 whether the KPTI patch has been released for jessie.
It’s also strictly speaking not a privilege escalation, it’s “see things you’re not supposed to.”, such as all sorts of secrets. The attacker does not gain any write or execution privileges, though.
OMG, I didn't know that. Thanks.
If you feel paranoid, you might also want to disable JS by default and only enable by whitelist on any machines that hold particularly sensitive or valuable data.
See the "Fantastic Timers" paper. Link to HN discussion: https://news.ycombinator.com/item?id=16080235
The attack is already pretty damn slow (1kB/s) in C, if you have to collect a statistically significant sample in JS it might well slow down enough to not really work properly.
Does that mean that we are soon going to be vulnerable to remote exploits via WASM as well? Do mitigation attempts such as reducing the JavaScript timing resolution aslo apply to WASM?
Similar to the powershell script for Windows?
I am getting:
fpu_exception : yesEdit: facepalm. Or should that be foot-in-mouth?
Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-104-generic x86_64)
I ran the following command: sudo cat /proc/cpuinfo | grep pti
which returned: fpu_exception : yes
Note the instance of 'pti' in the word 'exception'.[ 0.000000] Kernel/User page tables isolation: enabled
1. With dmesg
dmesg -wH | grep 'page tables isolation'
2. With /proc/cpuinfo
grep cpu_insecure /proc/cpuinfo && echo "Patched" || echo "Unpatched!"
[1] https://askubuntu.com/questions/992137/how-to-check-that-kpt...
Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-104-generic x86_64)
is unpatched! Is it because of LTS version? Most servers run this including mine.They got caught out by the embargo being ended early.
This Ubuntu Wiki page is being updated with relevant information and package updates as they become available:
https://wiki.ubuntu.com/SecurityTeam/KnowledgeBase/SpectreAn...
dmesg -H | grep 'page tables isolation'
better, because dmesg -wH doesn't return and I suppose the 'page tables isolation' appears during boot.If you use journald, it by default saves the kernel's ring buffer to disk, so you can use it to check for that message:
sudo journalctl -b -o cat | grep "page table isolation"
dmesg -H | grep 'page tables isolation'
[ +0.000000] Kernel/User page tables isolation: enabled
grep cpu_insecure /proc/cpuinfo && echo "Patched" || echo "Unpatched!"
Unpatched!
cat /proc/cpuinfo | grep pti
fpu_exception : yes
uname -a
Linux host 4.9.0-5-amd64 #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04) x86_64 GNU/Linux
So page tables isolation seems to be enabled but neither the pti flag nor the cpu_insecure bug is in cpuinfo.EDIT: Maybe this is because it is Xen guest. Do I need pti on a XEN guest if the host is fully patched?
That command checks for the "bugs: cpu_insecure" entry in /proc/cpuinfo. However, that line only appears in some of the kernel versions. Recent kernels will have either "cpu_insecure" or "cpu_meltdown" (the name has been changed), while for instance the 3.10 kernel from CentOS 7, which has a backported version of these patches, doesn't even have the "bugs:" field.
And it's that 3.10 kernel which has all the workarounds (both for Spectre and Meltdown), while the more recent kernel has only what's been upstreamed, which so far is only the Meltdown workaround.
It's a mess.
https://blogs.technet.microsoft.com/ralphkyttle/2018/01/05/v...
I'm on CentOS right now and love it, but from what I've understand so far it would be preferable to be on a newer kernel.
I was planning to look at Ubuntu LTS and while they do have updated kernels available they seem to ignore LTS: https://wiki.ubuntu.com/Kernel/LTSEnablementStack
Also, 18.04 will be based on 4.15 which doesn't make sense to me.
Debian stable maybe?
EDIT: I know I can install updated kernels but I'd rather stick with what a core distribution provides if possible
What I meant is: Ubuntu LTS seems to not give a damn if the kernel they use is also an LTS release.
Examples would be: 14.04, 16.04 HWE kernels, 18.04 (currently planned to be 4.15).
https://wiki.ubuntu.com/SecurityTeam/KnowledgeBase/SpectreAn...
The whole problem is that the kernel/user protection is just a sham that is not being taken seriously by the CPU implementation. It allows access to take place without a proper mode change. Basically the whole fetch-decode-execute machinery (all of its pipelines, caches, registers and other areeas) should be regarded as untrusted and prevented from accessing or storing anything unauthorized according to the current security state of the CPU.
Spectre doesn't care about kernel/user at all. So even other CPUs are susceptible. Every CPU that speculates is vulnerable in theory.
https://help.joyent.com/hc/en-us/articles/115015938847-Secur...
If your Linux systems are running a normal Linux
distribution, go update your kernel. They should
all have the updates in them already.
I use Linux Mint and have not seen any recent kernel updates.Which kernel version is considered safe?
For servers running Ubuntu, what is the risk, as long as my services don't run arbitrary user uploaded executables? As far as I can tell it is that a different remote code execution exploit can now read the entire memory, possibly leaking secrets. Assuming we have a kernel update in the next few days, I would need to install it immediately and rotate passwords and keys. Should I revoke TLS certs? Is that paranoid?
This won't stop the memory from being accessed, but it has a better chance of stopping things that can exploit the bug(s) in the first place.
Revoking TLS certs is probably a little bit on the side of paranoia.
I think you're on the right track -- just watch for the kernel update, and rotate passwords plus keys if it's not a hassle.
He is right, though. It would take two vulnerabilities to pwn him: one allowing remote code execution and then another (Spectre/Meltdown) to gain access to privileged data that shouldn’t be available in that context.
Too many machines put on too many hats. A single (physical) “secure” server should do as little as possible and run as small a codebase as possible. And never run - sandboxes or otherwise - code that isn’t authorized.
We seem to be forgetting that in all this. If you only run code you trust, you are safe. This can only happen if you run in trusted code on your machine. We’ve taken running untrustworthy code in a “sandboxed” environment to mean “not running untrusted code, when it’s totally not the case.
Of course, if an attacker uses a remote execution vulnerability to get into the box with user-constrained permissions, this can be used to read guest memory without concern for user limitation, so in that way it's a long-term pernicious threat that will make local exploitation significantly easier, and security-conscious organizations will still opt to use it despite the fact that they don't run untrusted code. Also, since this would allow them to read all memory in the guest, if you have sensitive stuff like database credentials coming into memory, they could be sniffed without requiring further exploitation.
Also, consider that at present, PTI is disabled by default for AMD chips, based on AMD's assurances that Meltdown does not affect them. If you're running in the cloud and your host is AMD-based, you don't need PTI in either the guest or the host.
"Ubuntu users of the 64-bit x86 architecture (aka, amd64) can expect updated kernels by the original January 9, 2018 coordinated release date, and sooner if possible."
https://insights.ubuntu.com/2018/01/04/ubuntu-updates-for-th...
If you're not aware Linux Mint turns off kernel security updates _off_, you need to check by hand.
If you must use desktop Linux, I guess I'll be recommending Ubuntu from now on. In my testing Mint and Ubuntu both work pretty well out of the box on lots of different hardware configurations unlike other distros. But learning this really tips the scale, Ubuntu or bust.
> However there are lots of systems out there that are not running “normal” Linux distributions for various reasons (rumor has it that it is way more than the “traditional” corporate distros). They rely on the LTS kernel updates, or the normal stable kernel updates, or they are in-house franken-kernels. For those people here’s the status of what is going on regarding all of this mess in the upstream kernels you can use.
Mint is one of those.
"For the 4.4 and 4.9 LTS kernels, odds are these patches will never get merged into them, due to the large number of prerequisite patches required. All of those prerequisite patches have been long merged and tested in the android-common kernels, so I think it is a better idea to just rely on those kernel branches instead of the LTS release for ARM systems at this point in time."
Great. Into the trash it goes.
I don't see why "apt upgrade" wouldn't install the new kernel. It's hard to tell what when wrong without knowing any details.
Anyway, if apt decided to hold back a package for some reason, most of the time you should be able to install it with "apt(-get) install". Do not install packages with dpkg unless you know what you're doing.
other options include "apt upgrade --with-new-pkgs" or using unattended-upgrades to automatically install them.
Make sure "linux-image-amd64" package is installed for Debian (and whatever equivalent package name for Ubuntu) and "apt upgrade" will install new kernel packages just fine.
(And this is actually not even needed for most kernel updates in Debian because most of the time package name stays same and updated in place, package name is only changed if ABI is changed and requires recompilation of DKMS modules)
But for a large number of people - Americans, folks in countries with monopolies or state manipulation of internet traffic - it is not.
Not everyone has a different ISP to choose from. VPNs are a risky proposition and can significantly reduce bandwidth and increase latency.
https://www.virusbulletin.com/conference/vb2017/abstracts/la...
Is the exposition carefully publicized so the flaw is not exploitable by malicious hackers?
Or does Project Zero expose everything, and a malicious hacker can read it and create code that spreads over the internet to harm computers?
I hope it's not the second case because that should cause global panic.
1) the vulnerability is local, not directly tied to spreading as malware (but these days placing JavaScript in an ad is easier and possibly more effective than a virus...)
2) there is no such thing as "exposition carefully publicized so the flaw is not exploitable by malicious hackers". Just assume that black hats are as smart as white hats or smarter.
You're missing the point. Not doubting the smartness of black hats, white hats likely took their time to discover the flaw. If you make the details public in a controlled manner and then announce the fixes shortly after, you essentially did not give black hats enough time to fill the missing pieces of the public announcement.
For instance, in the extreme case, the statement "we have discovered a flaw at the hardware/CPU level in such and such chips, and we call it meltdown and spectre", it's pretty obvious the black hats would have no clue what it is. (They may have already discovered it on their own, and may have named the flaws something completely different. Even then they wouldn't know if white-hats discovered what they discovered.)