Retpoline mitigations for Spectre variant 2

Asked by corrado venturini

On my Ubuntu 18.04 Bionic I added the PPA 'Retpoline mitigations for Spectre variant 2' suggested in https://wiki.ubuntu.com/SecurityTeam/KnowledgeBase/SpectreAndMeltdown. After apt update+upgrade the checker from https://github.com/speed47/spectre-meltdown-checker says I'm still vulnerable to 'Spectre Variant 2' but not to 'Spectre Variant 1' while the description of the PPA says: Note: Test kernels are missing Spectre variant 1 mitigations.

My hardware is as follows:
corrado@corrado-p7-bb-1221:~$ inxi -SCx
System: Host: corrado-p7-bb-1221 Kernel: 4.13.0-30-generic x86_64 bits: 64 gcc: 7.2.0
           Desktop: Gnome 3.26.2 (Gtk 3.22.26-2ubuntu1) Distro: Ubuntu Bionic Beaver (development branch)
CPU: Dual core Intel Core i3-7100 (-MT-MCP-) arch: Skylake rev.9 cache: 3072 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 15648
           clock speeds: max: 3900 MHz 1: 3900 MHz 2: 3900 MHz 3: 3900 MHz 4: 3900 MHz
corrado@corrado-p7-bb-1221:~$

spectre-meltdown-checker says:
corrado@corrado-p7-bb-1221:~$ sudo ./Downloads/spectre-meltdown-checker-master/spectre-meltdown-checker.sh
[sudo] password for corrado:
Spectre and Meltdown mitigation detection tool v0.33

Checking for vulnerabilities on current system
Kernel is Linux 4.13.0-30-generic #33-Ubuntu SMP Mon Jan 15 19:45:48 UTC 2018 x86_64
CPU is Intel(R) Core(TM) i3-7100 CPU @ 3.90GHz

Hardware check
* Hardware support (CPU microcode) for mitigation techniques
  * Indirect Branch Restricted Speculation (IBRS)
    * SPEC_CTRL MSR is available: NO
    * CPU indicates IBRS capability: NO
  * Indirect Branch Prediction Barrier (IBPB)
    * PRED_CMD MSR is available: NO
    * CPU indicates IBPB capability: NO
  * Single Thread Indirect Branch Predictors (STIBP)
    * SPEC_CTRL MSR is available: NO
    * CPU indicates STIBP capability: NO
  * Enhanced IBRS (IBRS_ALL)
    * CPU indicates ARCH_CAPABILITIES MSR availability: NO
    * ARCH_CAPABILITIES MSR advertises IBRS_ALL capability: NO
  * CPU explicitly indicates not being vulnerable to Meltdown (RDCL_NO): NO
  * CPU microcode is known to cause stability problems: NO
* CPU vulnerability to the three speculative execution attacks variants
  * Vulnerable to Variant 1: YES
  * Vulnerable to Variant 2: YES
  * Vulnerable to Variant 3: YES

CVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'
* Checking count of LFENCE opcodes in kernel: YES
> STATUS: NOT VULNERABLE (114 opcodes found, which is >= 70, heuristic to be improved when official patches become available)

CVE-2017-5715 [branch target injection] aka 'Spectre Variant 2'
* Mitigation 1
  * Kernel is compiled with IBRS/IBPB support: YES
  * Currently enabled features
    * IBRS enabled for Kernel space: NO (echo 1 > /proc/sys/kernel/ibrs_enabled)
    * IBRS enabled for User space: NO (echo 2 > /proc/sys/kernel/ibrs_enabled)
    * IBPB enabled: NO (echo 1 > /proc/sys/kernel/ibpb_enabled)
* Mitigation 2
  * Kernel compiled with retpoline option: NO
  * Kernel compiled with a retpoline-aware compiler: NO
  * Retpoline enabled: NO
> STATUS: VULNERABLE (IBRS hardware + kernel support OR kernel with retpoline are needed to mitigate the vulnerability)

CVE-2017-5754 [rogue data cache load] aka 'Meltdown' aka 'Variant 3'
* Kernel supports Page Table Isolation (PTI): YES
* PTI enabled and active: YES
* Running as a Xen PV DomU: NO
> STATUS: NOT VULNERABLE (PTI mitigates the vulnerability)

A false sense of security is worse than no security at all, see --disclaimer
corrado@corrado-p7-bb-1221:~$

should I manually enable /proc/sys/kernel/ibrs_enabled ?
or contact <email address hidden>? (it seems me a too stupid question to disturb security team)
thanks

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

It seems to me that ppa:canonical-kernel-team/spectre provides a retpoline-enabled kernel version only for artful (17.10), and the kernel that you are running (and which ist tested by the spectre-meltdown-checker tool) is still the one from the normal repositories and does not have retpoline logic.

see https://launchpad.net/~canonical-kernel-team/+archive/ubuntu/spectre/+packages

Revision history for this message
corrado venturini (corradoventu) said :
#2

The link You cite says: This PPA currently publishes packages for Bionic, Artful, and Xenial.
and the PPA was correctly found when I run apt update+upgrade.
Anyway I have the same problem on Artful:
corrado@corrado-p6-aa:~$ sudo apt update
[sudo] password for corrado:
Hit:1 http://ppa.launchpad.net/canonical-kernel-team/spectre/ubuntu artful InRelease
Hit:2 http://archive.ubuntu.com/ubuntu artful InRelease
Get:3 http://archive.ubuntu.com/ubuntu artful-updates InRelease [78,6 kB]
Get:4 http://archive.ubuntu.com/ubuntu artful-backports InRelease [72,2 kB]
Get:5 http://archive.ubuntu.com/ubuntu artful-security InRelease [78,6 kB]
Get:6 http://archive.ubuntu.com/ubuntu artful-updates/main amd64 DEP-11 Metadata [68,8 kB]
Get:7 http://archive.ubuntu.com/ubuntu artful-updates/main DEP-11 64x64 Icons [43,3 kB]
Get:8 http://archive.ubuntu.com/ubuntu artful-updates/universe amd64 DEP-11 Metadata [48,4 kB]
Get:9 http://archive.ubuntu.com/ubuntu artful-updates/universe DEP-11 64x64 Icons [52,8 kB]
Get:10 http://archive.ubuntu.com/ubuntu artful-backports/universe amd64 DEP-11 Metadata [4.708 B]
Get:11 http://archive.ubuntu.com/ubuntu artful-security/main amd64 DEP-11 Metadata [2.924 B]
Get:12 http://archive.ubuntu.com/ubuntu artful-security/universe amd64 DEP-11 Metadata [10,4 kB]
Get:13 http://archive.ubuntu.com/ubuntu artful-security/universe DEP-11 64x64 Icons [10,2 kB]
Fetched 471 kB in 1s (451 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
corrado@corrado-p6-aa:~$ sudo ./Downloads/spectre-meltdown-checker-master/spectre-meltdown-checker.sh
Spectre and Meltdown mitigation detection tool v0.33

Checking for vulnerabilities on current system
Kernel is Linux 4.13.0-32-generic #35-Ubuntu SMP Thu Jan 25 09:13:46 UTC 2018 x86_64
CPU is Intel(R) Core(TM) i3-7100 CPU @ 3.90GHz

Hardware check
* Hardware support (CPU microcode) for mitigation techniques
  * Indirect Branch Restricted Speculation (IBRS)
    * SPEC_CTRL MSR is available: NO
    * CPU indicates IBRS capability: NO
  * Indirect Branch Prediction Barrier (IBPB)
    * PRED_CMD MSR is available: NO
    * CPU indicates IBPB capability: NO
  * Single Thread Indirect Branch Predictors (STIBP)
    * SPEC_CTRL MSR is available: NO
    * CPU indicates STIBP capability: NO
  * Enhanced IBRS (IBRS_ALL)
    * CPU indicates ARCH_CAPABILITIES MSR availability: NO
    * ARCH_CAPABILITIES MSR advertises IBRS_ALL capability: NO
  * CPU explicitly indicates not being vulnerable to Meltdown (RDCL_NO): NO
  * CPU microcode is known to cause stability problems: NO
* CPU vulnerability to the three speculative execution attacks variants
  * Vulnerable to Variant 1: YES
  * Vulnerable to Variant 2: YES
  * Vulnerable to Variant 3: YES

CVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'
* Checking count of LFENCE opcodes in kernel: YES
> STATUS: NOT VULNERABLE (114 opcodes found, which is >= 70, heuristic to be improved when official patches become available)

CVE-2017-5715 [branch target injection] aka 'Spectre Variant 2'
* Mitigation 1
  * Kernel is compiled with IBRS/IBPB support: YES
  * Currently enabled features
    * IBRS enabled for Kernel space: NO (echo 1 > /proc/sys/kernel/ibrs_enabled)
    * IBRS enabled for User space: NO (echo 2 > /proc/sys/kernel/ibrs_enabled)
    * IBPB enabled: NO (echo 1 > /proc/sys/kernel/ibpb_enabled)
* Mitigation 2
  * Kernel compiled with retpoline option: NO
  * Kernel compiled with a retpoline-aware compiler: NO
  * Retpoline enabled: NO
> STATUS: VULNERABLE (IBRS hardware + kernel support OR kernel with retpoline are needed to mitigate the vulnerability)

CVE-2017-5754 [rogue data cache load] aka 'Meltdown' aka 'Variant 3'
* Kernel supports Page Table Isolation (PTI): YES
* PTI enabled and active: YES
* Running as a Xen PV DomU: NO
> STATUS: NOT VULNERABLE (PTI mitigates the vulnerability)

A false sense of security is worse than no security at all, see --disclaimer
corrado@corrado-p6-aa:~$ inxi -SCx
System: Host: corrado-p6-aa Kernel: 4.13.0-32-generic x86_64 bits: 64 gcc: 7.2.0
           Desktop: Gnome 3.26.2 (Gtk 3.22.25-0ubuntu0.1) Distro: Ubuntu 17.10
CPU: Dual core Intel Core i3-7100 (-HT-MCP-) arch: Skylake rev.9 cache: 3072 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 15648
           clock speeds: max: 3900 MHz 1: 3900 MHz 2: 3900 MHz 3: 3900 MHz 4: 3900 MHz
corrado@corrado-p6-aa:~$

Revision history for this message
Best Manfred Hampl (m-hampl) said :
#3

Check the contents of https://launchpad.net/~canonical-kernel-team/+archive/ubuntu/spectre/+packages

1. There is a package for bionic in that PPA, namely gcc-7, but no kernel package

2. The line

linux - 4.13.0-31.34~retpoline2 (Newer version available) ... Artful

shows that a kernel package with retpoline security for artful has been prepared (version 4.13.0-31...), but there is a version with a higher version number (namely 4.13.0-32...( in the standard Ubuntu repositories (without retpoline logic!)

If you want to test the retpoline-enabled kernel package, then you have to downgrade to the version in that PPA.

Revision history for this message
corrado venturini (corradoventu) said :
#4

ok, thanks a lot

Revision history for this message
corrado venturini (corradoventu) said :
#5

Thanks Manfred Hampl, that solved my question.