Linux対応状況 – 近代的CPUの脆弱性

先日、書いた記事「近代的CPUの脆弱性:Meltdown・Spectre」を Linux に的を絞って掘り下げました。

予備知識

共通点

Linux の Meltdown 対策は、2018年初頭 KPTIのパッチ群をカーネル 4.15 でリリースしたことにより落ち着きを取り戻しつつあります。

ウィキペディアによると、以下のカーネルがKPTI適用済みとなっていますが、詳細は下記「ディストリビューションごとの対応」をご参照ください。

  • 4.15
  • 4.14.11
  • 4.9.75
  • 4.4.110

base on Kernel page-table isolation - Wikipedia

Kernel page-table isolation (KPTI)
KPTI was merged into Linux kernel version 4.15,[7] and backported to Linux kernels 4.14.11, 4.9.75, 4.4.110.
KPTI fixes these leaks by separating user-space and kernel-space page tables entirely.

カーネルページテーブル分離 (KPTI)
KPTI はLinuxカーネルバージョン4.15に統合され、Linuxカーネル4.14.11, 4.9.75, 4.4.110にバックポートされました。
KPTIは、ユーザ空間とカーネル空間のページテーブルを完全に分離することにより、これらのリーク(脆弱性)を修正しています。

注意点

32bit のカーネルは KPTI 未対応です(32bit の OSイメージを利用する場合)。

ディストリビューションごとの対応

普段使っているOSについて対応を確認しました。

Ubuntu

公式ブログに対策済みバージョンの表記があります。
なお、下記にはありませんが Ubuntu 18.04 LTS(Bonic) もカーネル4.15 がリリースされているので対策済みです。

base on Ubuntu Updates for the Meltdown / Spectre Vulnerabilities | Ubuntu blog
4 January 2018
At its heart, this vulnerability is a CPU hardware architecture design issue. But there are billions of affected hardware devices, and replacing CPUs is simply unreasonable. As a result, operating system kernels — Windows, MacOS, Linux, and many others — are being patched to mitigate the critical security vulnerability.

Updates will be available for:

  • Ubuntu 17.10 (Artful) — Linux 4.13 HWE
  • Ubuntu 16.04 LTS (Xenial) — Linux 4.4 (and 4.4 HWE)
  • Ubuntu 14.04 LTS (Trusty) — Linux 3.13

These kernel fixes will not be Livepatch-able. The source code changes required to address this problem is comprised of hundreds of independent patches, touching hundreds of files and thousands of lines of code. The sheer complexity of this patchset is not compatible with the Linux kernel Livepatch mechanism. An update and a reboot will be required to active this update.

この脆弱性は、CPUハードウェアアーキテクチャの設計上の問題です。ただし、影響を受けるハードウェアデバイスが何十億もあり、CPUを置き換えるだけでは不合理です。その結果、オペレーティングシステムのカーネル(Windows、MacOS、Linuxなど)は、重大なセキュリティ上の脆弱性を緩和するためにパッチが適用されています。

  • アップデートは以下の目的で利用できます。

  • Ubuntu 17.10(Artful) - Linux 4.13 HWE

  • Ubuntu 16.04 LTS(Xenial) - Linux 4.4(および4.4 HWE)CentOSのリポジトリに落ちてくれば使える
  • Ubuntu 14.04 LTS(Trusty) - Linux 3.13

これらのカーネルの修正はLivepatchできません。この問題に対処するために必要なソースコードの変更は、何百もの独立したパッチで構成されており、数百のファイルや数千行のコードに触れています。このパッチセットの複雑さは、LinuxカーネルのLivepatchメカニズムと互換性がありません。このアップデートを有効にするには、アップデートと再起動が必要です。

Debian

Debianは公式ページで分かりやすく表で掲載されています。
表はコードネーム表記になっています。
バージョン番号とサポート期限は、過去記事でご覧いただけます。

  • 用語

D番号については、Debian パッケージの脆弱性の情報を CVE 名 or パッケージ名で検索できる、Security Bug Tracker が便利、且つ分かりやすいです。

base on DebianSecurity/SpectreMeltdown - Debian Wiki
last modified 2018-02-26 19:53:33

64-bit PC (amd64)
AMD processors are believed not to be affected by Meltdown, and no mitigation is applied to them by default.

AMDプロセッサはMeltdownの影響を受けないと考えられており、デフォルトでは緩和は適用されません。

Release Linux version Spectre 1 Spectre 2 Meltdown
Wheezy/oldoldstable 3.2 not fixed not fixed DLA-1232-1
Jessie/oldstable 3.16 not fixed not fixed DSA-4082-1
Stretch/stable 4.9 DSA-4120-1 DSA-4120-1 DSA-4078-1
Buster/testing/unstable 4.14+ 4.15.4-1 and later 4.14.17-1 and later 4.14.13-1 and later

32-bit PC (i386)
The recommended mitigation for Meltdown for i386 users is to enable amd64 as an additional architecture (see Multiarch/HOWTO) and install a 64-bit kernel. Work is in progress to backport the meltdown patches to i386 to the kernel.

i386ユーザーのためのメルトダウンのための推奨される緩和策は、amd64を追加のアーキテクチャーとして有効にして(Multiarch / HOWTOを参照)、64ビットカーネルをインストールすることです。メルトダウンパッチをi386にカーネルにバックポートする作業が進行中です。

Release Linux version Spectre 1 Spectre 2 Meltdown
Wheezy/oldoldstable 3.2 not fixed not fixed not fixed
Jessie/oldstable 3.16 not fixed not fixed not fixed
Stretch/stable 4.9 DSA-4120-1 DSA-4120-1 not fixed
Buster/testing/unstable 4.14+ 4.15.4-1 and later 4.14.17-1 and later not fixed

64-bit ARM (arm64)
Work is in progress to backport Meltdown patches to arm64.

Meltdownパッチをarm64にバックポートする作業が進行中です。

Release Linux version Spectre 1 Spectre 2 Meltdown
Jessie/oldstable 3.16 not fixed not fixed not fixed
Stretch/stable 4.9 DSA-4120-1 not fixed not fixed
Buster/testing/unstable 4.14+ 4.15.4-1 and later not fixed not fixed

32-bit ARM (armel, armhf)

Release Linux version Spectre 1 Spectre 2 Meltdown
Wheezy/oldoldstable 3.2 not fixed not fixed not fixed
Jessie/oldstable 3.16 not fixed not fixed not fixed
Stretch/stable 4.9 DSA-4120-1 not fixed not fixed
Buster/testing/unstable 4.14+ 4.15.4-1 and later not fixed not fixed

Checking status
In stretch-backports, buster and sid there is a package spectre-meltdown-checker which can be used to help determine ones vulnerability status.

Debian 9, Debian 10 以降の開発版には、脆弱性の状態を判断するのに役立つパッケージ、スペクター-メルトダウン-チェッカー (Debian Package Tracker - spectre-meltdown-checker)があります。

sudo apt install -t stretch-backports spectre-meltdown-checker
sudo spectre-meltdown-checker

Furthermore, kernel-level mitigation strategies are visible from userspace in the /sys/devices/system/cpu/vulnerabilities/ directory. For example, this is the output after a successful kernel update in Debian stretch:

さらに、カーネルレベルの軽減戦略は、/ sys / devices / system / cpu / vulnerabilities /ディレクトリのユーザー空間から見ることができます。たとえば、これはDebianストレッチでカーネルが正常に更新された後の出力です:

$ grep . /sys/devices/system/cpu/vulnerabilities/*
/sys/devices/system/cpu/vulnerabilities/meltdown:Mitigation: PTI
/sys/devices/system/cpu/vulnerabilities/spectre_v1:Mitigation: __user pointer sanitization
/sys/devices/system/cpu/vulnerabilities/spectre_v2:Mitigation: Full generic retpoline

Red Hat Enterprise Linux

以下の製品にアップデートパッチが配布されています。

バージョン 備考
RHEL 5 Extended Lifecycle Support(延長サポート版)のため、CentOSは無し
RHEL 6 CentOSのリポジトリに落ちてきたものを利用
RHEL 7 CentOSのリポジトリに落ちてきたものを利用

Fedora

Fedora 26 は既に EOL(End Of Life)しているので、Fedora 27・28 が対象になります。
通常通り、アップデートをしていればカーネル 4.15 以上になっていると思いますので、概ね問題ないでしょう。

EOLについては下記をご参照ください。