Below is a post about the Spectre and Meltdown Security vulnerabilities and mostly how it relates to Ubuntu.
Spectre and Meltdown Background
Google Project Zero found a server-side hardware bug (undocumented feature) that allows reading of privileged memory by leveraging a CPU (and possibly any GPU and SOC) feature to execute code ahead of time in “if” code branches before the result of the “if” case is known. This execute code ahead of demand feature was added to speed up processors to assists the FETCH, DECODE, EXECUTE and WRITE-BACK stages in the execution pipeline preparation.
Processors hate reading from main memory (it is too slow) so if data can be PREFETCHED or CACHED before being executed in the CPU allowing the CPU can do more work. This bug/flaw is not really a bug/flaw IMHO but an insecure efficiency feature.
Read more on the Spectre and Meltdown bug here at Wired.
Aside: Check out the Red Hill Hardware guide and the evolution (documentation) of early CPU’s.
You can read more about the Pentium 4’s cache, rapid execution engine and instruction set additions to learn more about the evolution of CPU efficiency here.
Making processors faster (adding more MHZ) may be futile if the cache is too small or slow, and simply adding more cache can increase costs. Branch prediction was a way to increase performance (by using idle clock cycles or saving clock cycles) without adding extra cache or silicone (extra cost). I suspect in the future branch prediction and read ahead features may be locked down or processor manufacturers may swing back to adding more MHZ/Cores/Cache.
Anandtech https://www.anandtech.com have a great article on branch prediction (I can’t find the article now but will add it when I find it later) but this guide gives the gist.
A CPU is much like a checkout area at a grocery store, and a multi-core CPU is like a grocery store with multiple checkouts.
- Things (processing and reading to/from memory) happen sequentially (per core).
- Only one item can be scanned (processed) at a time (per core).
- Customers trolleys and items are like program threads and items to scan (to be calculated in the CPU).
- Customers trolleys (programs with things to calculate) line up and wait for the CPU (attendant) to scan (execute) items. PRE-FETCH and other CPU tasks help organize data related to instructions.
- One checkout line (core) cannot read or affect items at another checkout (thread safety).
When a price check is called on an item (causing huge delays while the price is being checked by a runner (reading from main memory)) the checkout attendant (CPU core) processes the next items at the checkout (items in the processor execution pipeline). Branch predicting will read ahead in idle times to prevent idle delays or cache-misses to prevent slowdown. Processors usually make sure things are in the processors L3, L2 or L1 memory before they are executed but some commands with pre-requisite data cannot be pre-cached.
CPU instruction information
Here is a list of x86 instructions
Troy Hunt in Weekly Update 68 https://www.troyhunt.com/weekly-update-68/ mentioned a twitter thread by Graham Sutherland (@gsuberland) https://twitter.com/gsuberland/status/948907452786933762 that summaries speculative execution more succinctly. Meltdown and Spectre bugs are due to the speculative execution in the processor.
Official Information on Spectre and Meltdown
Proof of concepts exploits in the wide
I have a number of Ubuntu servers and I have updated them to fix Spectre and Meltdown issues.
UpCloud is my favourite cloud provider.
- How to buy a new domain and SSL cert from NameCheap, (Ubuntu) Server from Digital Ocean and configure it
Ubuntu said here that is has been notified by Intel of this issue since November 09 2017.
Ubuntu Timeline (16.04 related snip from here)
- 2017 Nov 09: the Ubuntu Security team is notified by Intel under NDA.
- 2017 Nov 20: the CRD is established as 2018-01-09.
- 2017 Dec: the Ubuntu Security team receives notifications from additional silicon vendors about the impact to their products.
- 2018 Jan 03: issue becomes public a few days before the CRD.
- 2018 Jan 04: Canonical publicly communicates the planned update schedule.
- 2018 Jan 04: Mozilla releases timing attack mitigations.
- 2018 Jan 05: Ubuntu Firefox updates are made available in USN 3516-1.
- 2018 Jan 07: Candidate kernels are beginning to be made available for testing at ppa:canonical-kernel-team/pti. This initial round will address CVE-2017-5754 (aka Meltdown or Variant 3) for x86_64. We will address CVE-2017-5715 and CVE-2017-5753 (aka Spectre or Variant 1 & 2) in a subsequent round. We will also address additional architectures in subsequent rounds. Kernels currently available are as follows. We will continue to update this table as more become available:
- Package: linux, Version: 4.4.0-108.131, Series: Xenial 16.04
- -2018 Jan 09: NVIDIA driver updates published, see USN-3521-1.
- Cloud image updates.
- Core image updates.
At this time it looks like this has been fixed on Ubuntu 16.04 LTS (Xenial Xerus) with released (57.0.4+build1-0ubuntu0.16.04.1). Consider updating your Ubuntu servers.
You can follow the Ubuntu CVE listing here to be ahead of future security issues.
Spectre and Meltdown related Ubuntu CVE’s
Spectre – CVE-2017-5715
Description: Systems with microprocessors utilizing speculative execution and indirect branch prediction may allow unauthorized disclosure of information to an attacker with local user access via a side-channel analysis.
Spectre – CVE-2017-5753
Description: Systems with microprocessors utilizing speculative execution and branch prediction may allow unauthorized disclosure of information to an attacker with local user access via a side-channel analysis.
Ubuntu-Description: Jann Horn discovered that microprocessors utilizing speculative execution and branch prediction may allow unauthorized memory reads via side-channel attacks. This flaw is known as Spectre. A local attacker could use this to expose sensitive information, including kernel memory.
Meltdown – CVE-2017-5754
Description: Systems with microprocessors utilizing speculative execution and indirect branch prediction may allow unauthorized disclosure of information to an attacker with local user access via a side-channel analysis of the data cache.
Ubuntu-Description: Jann Horn discovered that microprocessors utilizing speculative execution and indirect branch prediction may allow unauthorized memory reads via side-channel attacks. This flaw is known as Meltdown. A local attacker could use this to expose sensitive information, including kernel memory.
Ubuntu Security News https://usn.ubuntu.com/usn/
Subscribe to the Ubuntu Security Announcement Distribution List https://lists.ubuntu.com/mailman/listinfo/ubuntu-security-announce
Ubuntu CVE Tracker (Main) http://people.canonical.com/~ubuntu-security/cve/main.html
Links from CVE articles
FYI: Ubuntu 17.04 will not be getting the Spectre and Meltdown fixes, this is a good reason why not to use a non-LTS (long time support) release of Ubuntu (abandoned after 9 months):
How to update Ubuntu
As always backup your server and configuration first (consider taking a snapshot). I run the following command to update my system and reboot.
Warning: Some packages may overwrite in-production configuration files (or break production servers) so take your time updating, use test servers (green and blue or dev, test and prod) and only upgrade production when you are ready.
sudo apt update && sudo apt upgrade && shutdown -r now
fyi: AWS related Speculative Execution post: https://aws.amazon.com/security/security-bulletins/AWS-2018-013/
Impact on Future Program Build Times
Twitter user Peter Czanik (@PCzanik https://twitter.com/PCzanik) reports that compile times that fix speculative execution have increased his build times from 4 minutes to 21 minutes.
Understanding the performance impact of Spectre and Meltdown mitigations on Windows Systems
Report: Intel CPUs suffer from major security flaw, fix could bring notable performance hit to macOS
Here’s what every Chrome user should do in the wake of #Spectre
Microsoft reveals how Spectre updates can slow your PC down
Microsoft halts AMD Meltdown and Spectre patches after reports of unbootable PCs
Viewing the Change log of updatable packages
View the change log of updatable packages for a certain Cve.
sudo apt-get update
sudo apt-get changelog ntp | grep CVE-2017-5715
The output will show matches of updatable packages that match.
Ubuntu Cloud Tips
Read my guide on Useful Linux Terminal Commands https://fearby.com/article/useful-linux-terminal-commands/
Read my guide on how to setting up a Vultr VM (Ubuntu) and configuring it https://fearby.com/article/setting-vultr-vm-configuring/
Scott Manleys breakdown of Spectre and Meltdown
More Fearby.com Reading
- Run and Ubuntu Security scan with Lynis
- WordFence security plugin for WordPress
- Speeding up WordPress with the ewww.io ExactDN CDN and Image Compression Plugin
- Setting up additional server storage on cloud servers (block storage on Vultr)
Donate and make this blog better
Ask a question or recommend an article
v1.4 Scott Manleys link
v1.3 Added Anandtech article.
v1.2 Wired link.
v1.1 view the changelog of updatable packages.
v1.0 Initial Copy.
Hope this helps someone.