speed47 / spectre-meltdown-checker

Reptar, Downfall, Zenbleed, ZombieLoad, RIDL, Fallout, Foreshadow, Spectre, Meltdown vulnerability/mitigation checker for Linux & BSD
3.85k stars 476 forks source link

Incorrect hypervisor detection for L1TF VMM (CVE-2018-3646) for KVM #278

Closed mattvw closed 4 years ago

mattvw commented 5 years ago

(Moving this to an actual Issue...)

Incorrect detection of hypervisor for L1TF VMM for KVM VMs and host systems. KVM Host systems are all RHEL 7. I've tested this on RHEL 7 and Ubuntu 18.04 VMs running on KVM hosts.

See https://github.com/speed47/spectre-meltdown-checker/pull/277#issuecomment-485136962 and https://github.com/speed47/spectre-meltdown-checker/pull/277#issuecomment-485139283 (and also https://github.com/speed47/spectre-meltdown-checker/pull/277#issuecomment-485134961) for all the details.

I don't know if the "Booting paravirtualized kernel on bare hardware" dmesg check issue (described in https://github.com/speed47/spectre-meltdown-checker/pull/277#issuecomment-485136962) is specific to KVM or RHEL 7 (or both). But it certainly shows up ONLY on physical/bare hardware systems where virtualization is enabled in the BIOS for the (physical) system. So, I'm not sure why it's existence is used to determine that a system is NOT running a hypervisor.

And then there's the two checks that will indicate false-positive hypervisor detection within KVM VMs (via https://github.com/speed47/spectre-meltdown-checker/pull/277#issuecomment-485136962 and https://github.com/speed47/spectre-meltdown-checker/pull/277#issuecomment-485139283).

Also, the hypervisor CPU flag is set in KVM VMs, which again will cause another false-positive hypervisor detection within KVM VMs. It is NOT set on KVM host systems (at least not for RHEL 7).

Commit https://github.com/speed47/spectre-meltdown-checker/commit/906f54cf9ddcbbe279ffff4500fd861c5e36ed23 via PR https://github.com/speed47/spectre-meltdown-checker/pull/259 added this detection (with a typo fix via commit https://github.com/speed47/spectre-meltdown-checker/commit/d7d2e6934ba08a2de2e2c80bb42936a60b884b78).

Happy to provide any other details as needed!

mattvw commented 5 years ago

Example for KVM host for L1TF VMM (with all the debugging):

[root@host ~]# ./spectre-meltdown-checker.sh -v -v -v --cve CVE-2018-3646
Spectre and Meltdown mitigation detection tool v0.40

(debug) cpuid: leaf1 on cpu0, eax-ebx-ecx-edx:      198386    1050624 2147417087 3219913727
(debug) cpuid: wanted register (1) has value 198386 aka 000306f2
(debug) cpuid: shifted value by 0 is 198386 aka 306f2
(debug) cpuid: after AND 0xFFFFFFFF, final value is 198386 aka 306f2
Checking for vulnerabilities on current system
Kernel is Linux 3.10.0-957.1.3.el7.x86_64 #1 SMP Thu Nov 15 17:36:42 UTC 2018 x86_64
CPU is Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
(debug) found opt_kernel=/vmlinuz-3.10.0-957.1.3.el7.x86_64 in /proc/cmdline
(debug) opt_kernel is now /boot//vmlinuz-3.10.0-957.1.3.el7.x86_64
Will use kernel image /boot//vmlinuz-3.10.0-957.1.3.el7.x86_64
Will use kconfig /boot/config-3.10.0-957.1.3.el7.x86_64
Will use System.map file /proc/kallsyms
(debug) check_kernel: ret=0 size=6639920 sections=0 warnings=readelf: /boot//vmlinuz-3.10.0-957.1.3.el7.x86_64: Error: Not an ELF file - it has the wrong magic bytes at the start/
(debug) check_kernel: ... file is invalid
(debug) try_decompress: looking for gunzip magic in /boot//vmlinuz-3.10.0-957.1.3.el7.x86_64
(debug) try_decompress: magic for gunzip found at offset 18357:xy
(debug) check_kernel: ret=0 size=21354300 sections=11 warnings=
(debug) check_kernel: ... file is valid
(debug) try_decompress: decompressed with gunzip successfully!
Kernel image is Linux version 3.10.0-957.1.3.el7.x86_64 (mockbuild@x86-040.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 15 17:36:42 UTC 2018

Hardware check
* Hardware support (CPU microcode) for mitigation techniques
  * Indirect Branch Restricted Speculation (IBRS)
    * SPEC_CTRL MSR is available: (debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
 YES 
    * CPU indicates IBRS capability: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0      14251          0 2617245696
(debug) cpuid: wanted register (4) has value 2617245696 aka 9c000000
(debug) cpuid: shifted value by 26 is 39 aka 27
(debug) cpuid: after AND 1, final value is 1 aka 1
(debug) cpuid: wanted 1 and got 1
 YES  (SPEC_CTRL feature bit)
  * Indirect Branch Prediction Barrier (IBPB)
    * PRED_CMD MSR is available: (debug) write_msr: using perl
(debug) write_msr: for cpu 0 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 1 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 2 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 3 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 4 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 5 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 6 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 7 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 8 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 9 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 10 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 11 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 12 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 13 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 14 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 15 on msr 73, ret=0
 YES 
    * CPU indicates IBPB capability:  YES  (SPEC_CTRL feature bit)
  * Single Thread Indirect Branch Predictors (STIBP)
    * SPEC_CTRL MSR is available:  YES 
    * CPU indicates STIBP capability: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0      14251          0 2617245696
(debug) cpuid: wanted register (4) has value 2617245696 aka 9c000000
(debug) cpuid: shifted value by 27 is 19 aka 13
(debug) cpuid: after AND 1, final value is 1 aka 1
(debug) cpuid: wanted 1 and got 1
 YES  (Intel STIBP feature bit)
  * Speculative Store Bypass Disable (SSBD)
    * CPU indicates SSBD capability: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0      14251          0 2617245696
(debug) cpuid: wanted register (4) has value 2617245696 aka 9c000000
(debug) cpuid: shifted value by 31 is 1 aka 1
(debug) cpuid: after AND 1, final value is 1 aka 1
(debug) cpuid: wanted 1 and got 1
 YES  (Intel SSBD)
  * L1 data cache invalidation
    * FLUSH_CMD MSR is available: (debug) write_msr: using perl
(debug) write_msr: for cpu 0 on msr 267, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 1 on msr 267, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 2 on msr 267, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 3 on msr 267, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 4 on msr 267, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 5 on msr 267, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 6 on msr 267, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 7 on msr 267, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 8 on msr 267, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 9 on msr 267, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 10 on msr 267, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 11 on msr 267, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 12 on msr 267, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 13 on msr 267, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 14 on msr 267, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 15 on msr 267, ret=0
 YES 
    * CPU indicates L1D flush capability: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0      14251          0 2617245696
(debug) cpuid: wanted register (4) has value 2617245696 aka 9c000000
(debug) cpuid: shifted value by 28 is 9 aka 9
(debug) cpuid: after AND 1, final value is 1 aka 1
(debug) cpuid: wanted 1 and got 1
 YES  (L1D flush feature bit)
  * Enhanced IBRS (IBRS_ALL)
    * CPU indicates ARCH_CAPABILITIES MSR availability: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0      14251          0 2617245696
(debug) cpuid: wanted register (4) has value 2617245696 aka 9c000000
(debug) cpuid: shifted value by 29 is 4 aka 4
(debug) cpuid: after AND 1, final value is 0 aka 0
(debug) cpuid: wanted 1 and got 0
 NO 
    * ARCH_CAPABILITIES MSR advertises IBRS_ALL capability:  NO 
  * CPU explicitly indicates not being vulnerable to Meltdown (RDCL_NO):  NO 
  * CPU explicitly indicates not being vulnerable to Variant 4 (SSB_NO):  NO 
  * CPU/Hypervisor indicates L1D flushing is not necessary on this system:  NO 
  * Hypervisor indicates host CPU might be vulnerable to RSB underflow (RSBA):  NO 
  * CPU supports Software Guard Extensions (SGX): (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0      14251          0 2617245696
(debug) cpuid: wanted register (2) has value 14251 aka 000037ab
(debug) cpuid: shifted value by 2 is 3562 aka dea
(debug) cpuid: after AND 1, final value is 0 aka 0
(debug) cpuid: wanted 1 and got 0
 NO 
  * CPU microcode is known to cause stability problems: (debug) is_ucode_blacklisted: no (63/2/61)
 NO  (model 0x3f family 0x6 stepping 0x2 ucode 0x3d cpuid 0x306f2)
  * CPU microcode is the latest known available version: (debug) is_latest_known_ucode: with cpuid 198386 has ucode 61, last known is 61 from 2018/04/20
 YES  (latest version is 0x3d dated 2018/04/20 according to builtin MCExtractor DB v96 - 2019/01/15)
* CPU vulnerability to the speculative execution attack variants
  * Vulnerable to CVE-2017-5753 (Spectre Variant 1, bounds check bypass): (debug) is_cpu_vulnerable: intel family 6 is vuln
(debug) is_cpu_vulnerable: temp results are <> <> <> <> <> <vuln>
(debug) is_cpu_vulnerable: final results are <0> <0> <0> <0> <0> <0> <1>
 YES 
  * Vulnerable to CVE-2017-5715 (Spectre Variant 2, branch target injection):  YES 
  * Vulnerable to CVE-2017-5754 (Variant 3, Meltdown, rogue data cache load):  YES 
  * Vulnerable to CVE-2018-3640 (Variant 3a, rogue system register read):  YES 
  * Vulnerable to CVE-2018-3639 (Variant 4, speculative store bypass):  YES 
  * Vulnerable to CVE-2018-3615 (Foreshadow (SGX), L1 terminal fault):  NO 
  * Vulnerable to CVE-2018-3620 (Foreshadow-NG (OS), L1 terminal fault):  YES 
  * Vulnerable to CVE-2018-3646 (Foreshadow-NG (VMM), L1 terminal fault):  YES 

CVE-2018-3646 aka 'Foreshadow-NG (VMM), L1 terminal fault'
* Information from the /sys interface: VMX: SMT disabled, L1D conditional cache flushes
* This system is a host running a hypervisor: (debug) hypervisor: unknown - hypervisor flag not set in /proc/cpuinfo
(debug) hypervisor: not present (bare hardware)- found in dmesg: [    0.000000] Booting paravirtualized kernel on bare hardware
 NO 
* Mitigation 1 (KVM)
  * EPT is disabled:  NO 
* Mitigation 2
  * L1D flush is supported by kernel:  YES  (found flush_l1d in /proc/cpuinfo)
  * L1D flush enabled:  YES  (conditional flushes)
  * Hardware-backed L1D flush supported:  YES  (performance impact of the mitigation will be greatly reduced)
  * Hyper-Threading (SMT) is enabled:  NO 
> STATUS:  NOT VULNERABLE  (this system is not running a hypervisor)

> SUMMARY: CVE-2018-3646:OK

(debug) variables at end of script: '|capabilities_ibrs_all=0|capabilities_l1dflush_no=0|capabilities_rdcl_no=0|capabilities_rsba=0|capabilities_ssb_no=0|cpu_brand_prefix=I|cpu_cpuid=198386|cpu_family=6|cpu_flush_cmd=1|cpu_friendly_name='Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz'|cpuid_arch_capabilities=0|cpuid_ibpb=SPEC_CTRL|cpuid_ibrs=SPEC_CTRL|cpuid_sgx=0|cpuid_spec_ctrl=1|cpuid_ssbd='Intel SSBD'|cpu_mismatch=0|cpu_model=63|cpu_stepping=2|cpu_ucode=61|cpu_vendor=GenuineIntel|cve=CVE-2018-3646|dmesg_grepped='[    0.000000] Booting paravirtualized kernel on bare hardware'|echo_cmd_type=printf|echo_cmd=/usr/bin/printf|file=/sys/devices/system/cpu/vulnerabilities/l1tf|final_summary=' CVE-2018-3646:OK'|global_critical=0|global_unknown=0|has_vmm=0|i=15|idx_max_cpu=15|is_cpu_vulnerable_cached=1|kernel_err=|kernel=/tmp/kernel-Z6xW77|kerneltmp=/tmp/kernel-Z6xW77|kernel_version='Linux version 3.10.0-957.1.3.el7.x86_64 (mockbuild@x86-040.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 15 17:36:42 UTC 2018'|l1d_kernel='found flush_l1d in /proc/cpuinfo'|l1d_mode=1|mcedb_cache=/root/.mcedb|mcedb_info='builtin MCExtractor DB v96 - 2019/01/15'|mcedb_source=./spectre-meltdown-checker.sh|model=45|mode=silent|msg='VMX: SMT disabled, L1D conditional cache flushes'|n=16|ncpus=16|nrpe_vuln=|opt=|opt_arch_prefix=|opt_batch=0|opt_batch_format=text|opt_config=/boot/config-3.10.0-957.1.3.el7.x86_64|opt_coreos=0|opt_cve_all=0|opt_cve_list=' CVE-2018-3646'|opt_explain=0|opt_hw_only=0|opt_kernel=/boot//vmlinuz-3.10.0-957.1.3.el7.x86_64|opt_live=1|opt_live_explicit=0|opt_map=/proc/kallsyms|opt_no_color=0|opt_no_hw=0|opt_no_sysfs=0|opt_paranoid=0|opt_sysfs_only=0|opt_verbose=4|opt_vmm=-1|os=Linux|parse_cpu_details_done=1|pos=18357|procfs=/proc|pvulnstatus_last_cve=CVE-2018-3646|read_cpuid_value=0|read_msr_value='                    0'|regex='VMX:.*'|ret=0|ret24=0|ret25=0|selected_cve=CVE-2018-3646|smt_enabled=1|spec_ctrl_msr=1|status=UNK|stepping=7|supported_cve_list='CVE-2017-5753 CVE-2017-5715 CVE-2017-5754 CVE-2018-3640 CVE-2018-3639 CVE-2018-3615 CVE-2018-3620 CVE-2018-3646'|sys_interface_available=1|tuple=I,0x000306F2,0x0000003D,20180420|ucode=61|ucode_date=2018/04/20|ucode_found='model 0x3f family 0x6 stepping 0x2 ucode 0x3d cpuid 0x306f2'|ucode_latest='latest version is 0x3d dated 2018/04/20 according to builtin MCExtractor DB v96 - 2019/01/15'|val=0|variant1=0|variant2=0|variant3=0|variant3a=0|variant4=0|variantl1tf=0|variantl1tf_sgx=1|vulnstatus=OK|
Need more detailed information about mitigation options? Use --explain
A false sense of security is worse than no security at all, see --disclaimer

Example for VM running on KVM host for L1TF VMM (with all the debugging):

[root@vm ~]# ./spectre-meltdown-checker.sh -v -v -v --cve CVE-2018-3646
Spectre and Meltdown mitigation detection tool v0.40

(debug) cpuid: leaf1 on cpu0, eax-ebx-ecx-edx:      198340       2048 2683974147  126614525
(debug) cpuid: wanted register (1) has value 198340 aka 000306c4
(debug) cpuid: shifted value by 0 is 198340 aka 306c4
(debug) cpuid: after AND 0xFFFFFFFF, final value is 198340 aka 306c4
Checking for vulnerabilities on current system
Kernel is Linux 3.10.0-957.10.1.el7.x86_64 #1 SMP Thu Feb 7 07:12:53 UTC 2019 x86_64
CPU is Intel Core Processor (Haswell, IBRS)
(debug) found opt_kernel=/vmlinuz-3.10.0-957.10.1.el7.x86_64 in /proc/cmdline
(debug) opt_kernel is now /boot//vmlinuz-3.10.0-957.10.1.el7.x86_64
Will use kernel image /boot//vmlinuz-3.10.0-957.10.1.el7.x86_64
Will use kconfig /boot/config-3.10.0-957.10.1.el7.x86_64
Will use System.map file /proc/kallsyms
(debug) check_kernel: ret=0 size=6644016 sections=0 warnings=readelf: /boot//vmlinuz-3.10.0-957.10.1.el7.x86_64: Error: Not an ELF file - it has the wrong magic bytes at the start/
(debug) check_kernel: ... file is invalid
(debug) try_decompress: looking for gunzip magic in /boot//vmlinuz-3.10.0-957.10.1.el7.x86_64
(debug) try_decompress: magic for gunzip found at offset 18357:xy
(debug) check_kernel: ret=0 size=21354424 sections=11 warnings=
(debug) check_kernel: ... file is valid
(debug) try_decompress: decompressed with gunzip successfully!
Kernel image is Linux version 3.10.0-957.10.1.el7.x86_64 (mockbuild@x86-040.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Feb 7 07:12:53 UTC 2019

Hardware check
* Hardware support (CPU microcode) for mitigation techniques
  * Indirect Branch Restricted Speculation (IBRS)
    * SPEC_CTRL MSR is available: (debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
(debug) read_msr: using perl
(debug) read_msr: MSR=0x48 value is                     0
 YES 
    * CPU indicates IBRS capability: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0       1961          0 2214592512
(debug) cpuid: wanted register (4) has value 2214592512 aka 84000000
(debug) cpuid: shifted value by 26 is 33 aka 21
(debug) cpuid: after AND 1, final value is 1 aka 1
(debug) cpuid: wanted 1 and got 1
 YES  (SPEC_CTRL feature bit)
  * Indirect Branch Prediction Barrier (IBPB)
    * PRED_CMD MSR is available: (debug) write_msr: using perl
(debug) write_msr: for cpu 0 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 1 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 2 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 3 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 4 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 5 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 6 on msr 73, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 7 on msr 73, ret=0
 YES 
    * CPU indicates IBPB capability:  YES  (SPEC_CTRL feature bit)
  * Single Thread Indirect Branch Predictors (STIBP)
    * SPEC_CTRL MSR is available:  YES 
    * CPU indicates STIBP capability: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0       1961          0 2214592512
(debug) cpuid: wanted register (4) has value 2214592512 aka 84000000
(debug) cpuid: shifted value by 27 is 16 aka 10
(debug) cpuid: after AND 1, final value is 0 aka 0
(debug) cpuid: wanted 1 and got 0
 NO 
  * Speculative Store Bypass Disable (SSBD)
    * CPU indicates SSBD capability: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0       1961          0 2214592512
(debug) cpuid: wanted register (4) has value 2214592512 aka 84000000
(debug) cpuid: shifted value by 31 is 1 aka 1
(debug) cpuid: after AND 1, final value is 1 aka 1
(debug) cpuid: wanted 1 and got 1
 YES  (Intel SSBD)
  * L1 data cache invalidation
    * FLUSH_CMD MSR is available: (debug) write_msr: using perl
(debug) write_msr: for cpu 0 on msr 267, ret=1
(debug) write_msr: using perl
(debug) write_msr: for cpu 1 on msr 267, ret=1
(debug) write_msr: using perl
(debug) write_msr: for cpu 2 on msr 267, ret=1
(debug) write_msr: using perl
(debug) write_msr: for cpu 3 on msr 267, ret=1
(debug) write_msr: using perl
(debug) write_msr: for cpu 4 on msr 267, ret=1
(debug) write_msr: using perl
(debug) write_msr: for cpu 5 on msr 267, ret=1
(debug) write_msr: using perl
(debug) write_msr: for cpu 6 on msr 267, ret=1
(debug) write_msr: using perl
(debug) write_msr: for cpu 7 on msr 267, ret=1
 NO 
    * CPU indicates L1D flush capability: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0       1961          0 2214592512
(debug) cpuid: wanted register (4) has value 2214592512 aka 84000000
(debug) cpuid: shifted value by 28 is 8 aka 8
(debug) cpuid: after AND 1, final value is 0 aka 0
(debug) cpuid: wanted 1 and got 0
 NO 
  * Enhanced IBRS (IBRS_ALL)
    * CPU indicates ARCH_CAPABILITIES MSR availability: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0       1961          0 2214592512
(debug) cpuid: wanted register (4) has value 2214592512 aka 84000000
(debug) cpuid: shifted value by 29 is 4 aka 4
(debug) cpuid: after AND 1, final value is 0 aka 0
(debug) cpuid: wanted 1 and got 0
 NO 
    * ARCH_CAPABILITIES MSR advertises IBRS_ALL capability:  NO 
  * CPU explicitly indicates not being vulnerable to Meltdown (RDCL_NO):  NO 
  * CPU explicitly indicates not being vulnerable to Variant 4 (SSB_NO):  NO 
  * CPU/Hypervisor indicates L1D flushing is not necessary on this system:  NO 
  * Hypervisor indicates host CPU might be vulnerable to RSB underflow (RSBA):  NO 
  * CPU supports Software Guard Extensions (SGX): (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0       1961          0 2214592512
(debug) cpuid: wanted register (2) has value 1961 aka 000007a9
(debug) cpuid: shifted value by 2 is 490 aka 1ea
(debug) cpuid: after AND 1, final value is 0 aka 0
(debug) cpuid: wanted 1 and got 0
 NO 
  * CPU microcode is known to cause stability problems: (debug) is_ucode_blacklisted: no (60/4/1)
 NO  (model 0x3c family 0x6 stepping 0x4 ucode 0x1 cpuid 0x306c4)
  * CPU microcode is the latest known available version: (debug) is_latest_known_ucode: this cpuid is not referenced (198340)
 UNKNOWN  (latest microcode version for your CPU model is unknown)
* CPU vulnerability to the speculative execution attack variants
  * Vulnerable to CVE-2017-5753 (Spectre Variant 1, bounds check bypass): (debug) is_cpu_vulnerable: intel family 6 is vuln
(debug) is_cpu_vulnerable: temp results are <> <> <> <> <> <vuln>
(debug) is_cpu_vulnerable: final results are <0> <0> <0> <0> <0> <0> <1>
 YES 
  * Vulnerable to CVE-2017-5715 (Spectre Variant 2, branch target injection):  YES 
  * Vulnerable to CVE-2017-5754 (Variant 3, Meltdown, rogue data cache load):  YES 
  * Vulnerable to CVE-2018-3640 (Variant 3a, rogue system register read):  YES 
  * Vulnerable to CVE-2018-3639 (Variant 4, speculative store bypass):  YES 
  * Vulnerable to CVE-2018-3615 (Foreshadow (SGX), L1 terminal fault):  NO 
  * Vulnerable to CVE-2018-3620 (Foreshadow-NG (OS), L1 terminal fault):  YES 
  * Vulnerable to CVE-2018-3646 (Foreshadow-NG (VMM), L1 terminal fault):  YES 

CVE-2018-3646 aka 'Foreshadow-NG (VMM), L1 terminal fault'
* Information from the /sys interface: 
* This system is a host running a hypervisor: (debug) hypervisor: present - hypervisor flag set in /proc/cpuinfo
(debug) hypervisor: present - found in dmesg: [    0.000000] Hypervisor detected: KVM
(debug) hypervisor: present - found in dmesg: [    0.000000] Booting paravirtualized kernel on KVM
 YES 
* Mitigation 1 (KVM)
  * EPT is disabled:  N/A  (the kvm_intel module is not loaded)
* Mitigation 2
  * L1D flush is supported by kernel:  YES  (found flush_l1d in kernel image)
  * L1D flush enabled:  UNKNOWN  (unrecognized mode)
  * Hardware-backed L1D flush supported:  NO  (flush will be done in software, this is slower)
  * Hyper-Threading (SMT) is enabled:  NO 
> STATUS:  VULNERABLE  (disable EPT or enabled L1D flushing to mitigate the vulnerability)

> SUMMARY: CVE-2018-3646:KO

(debug) variables at end of script: '|capabilities_ibrs_all=0|capabilities_l1dflush_no=0|capabilities_rdcl_no=0|capabilities_rsba=0|capabilities_ssb_no=0|cpu_brand_prefix=I|cpu_cpuid=198340|cpu_family=6|cpu_friendly_name='Intel Core Processor (Haswell, IBRS)'|cpuid_arch_capabilities=0|cpuid_ibpb=SPEC_CTRL|cpuid_ibrs=SPEC_CTRL|cpuid_sgx=0|cpuid_spec_ctrl=1|cpuid_ssbd='Intel SSBD'|cpu_mismatch=0|cpu_model=60|cpu_stepping=4|cpu_ucode=1|cpu_vendor=GenuineIntel|cve=CVE-2018-3646|dmesg_grepped='[    0.000000] Booting paravirtualized kernel on KVM'|echo_cmd_type=printf|echo_cmd=/usr/bin/printf|file=/sys/devices/system/cpu/vulnerabilities/l1tf|final_summary=' CVE-2018-3646:KO'|global_critical=1|global_unknown=0|has_vmm=1|i=7|idx_max_cpu=7|is_cpu_vulnerable_cached=1|kernel_err=|kernel=/tmp/kernel-LqFn1u|kerneltmp=/tmp/kernel-LqFn1u|kernel_version='Linux version 3.10.0-957.10.1.el7.x86_64 (mockbuild@x86-040.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Feb 7 07:12:53 UTC 2019'|l1d_kernel='found flush_l1d in kernel image'|l1d_mode=-1|mcedb_cache=/root/.mcedb|mcedb_info='builtin MCExtractor DB v96 - 2019/01/15'|mcedb_source=./spectre-meltdown-checker.sh|model=45|mode=silent|msg=|n=8|ncpus=8|nrpe_vuln=|opt=|opt_arch_prefix=|opt_batch=0|opt_batch_format=text|opt_config=/boot/config-3.10.0-957.10.1.el7.x86_64|opt_coreos=0|opt_cve_all=0|opt_cve_list=' CVE-2018-3646'|opt_explain=0|opt_hw_only=0|opt_kernel=/boot//vmlinuz-3.10.0-957.10.1.el7.x86_64|opt_live=1|opt_live_explicit=0|opt_map=/proc/kallsyms|opt_no_color=0|opt_no_hw=0|opt_no_sysfs=0|opt_paranoid=0|opt_sysfs_only=0|opt_verbose=4|opt_vmm=-1|os=Linux|parse_cpu_details_done=1|pos=18357|procfs=/proc|pvulnstatus_last_cve=CVE-2018-3646|read_cpuid_value=0|read_msr_value='                    0'|regex='VMX:.*'|ret=0|ret24=0|ret25=0|selected_cve=CVE-2018-3646|smt_enabled=1|spec_ctrl_msr=1|status=UNK|stepping=7|supported_cve_list='CVE-2017-5753 CVE-2017-5715 CVE-2017-5754 CVE-2018-3640 CVE-2018-3639 CVE-2018-3615 CVE-2018-3620 CVE-2018-3646'|sys_interface_available=1|tuple=45,0x07,0x712|ucode_found='model 0x3c family 0x6 stepping 0x4 ucode 0x1 cpuid 0x306c4'|ucode_latest='latest microcode version for your CPU model is unknown'|val=1|variant1=0|variant2=0|variant3=0|variant3a=0|variant4=0|variantl1tf=0|variantl1tf_sgx=1|vulnstatus=VULN|
Need more detailed information about mitigation options? Use --explain
A false sense of security is worse than no security at all, see --disclaimer
mattvw commented 5 years ago

While rather crude, it looks like the ps method that you had in place, @speed47, before commit https://github.com/speed47/spectre-meltdown-checker/commit/906f54cf9ddcbbe279ffff4500fd861c5e36ed23 (and part of the v.0.40 release) actually works correctly for me (on both VM hosts and VMs)! ;)

mweissen13 commented 5 years ago

To chime in here, exactly the same thing happens in VMware VMs. I have worked around that by always specifying "--vmm no" on the command line.

Spectre and Meltdown mitigation detection tool v0.40

(debug) attempted to load module cpuid, insmod_cpuid=1 (debug) cpuid: leaf1 on cpu0, eax-ebx-ecx-edx: 198304 67584 4290388483 260832255 (debug) cpuid: wanted register (1) has value 198304 aka 000306a0 (debug) cpuid: shifted value by 0 is 198304 aka 306a0 (debug) cpuid: after AND 0xFFFFFFFF, final value is 198304 aka 306a0 Checking for vulnerabilities on current system Kernel is Linux 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64 CPU is Intel(R) Xeon(R) CPU E5-2667 v2 @ 3.30GHz (debug) found opt_kernel=/vmlinuz-4.9.0-8-amd64 in /proc/cmdline (debug) opt_kernel is now /boot//vmlinuz-4.9.0-8-amd64 Will use kernel image /boot//vmlinuz-4.9.0-8-amd64 Will use kconfig /boot/config-4.9.0-8-amd64 Will use System.map file /proc/kallsyms (debug) check_kernel: ret=0 size=4241184 sections=0 warnings=readelf: Error: Not an ELF file - it has the wrong magic bytes at the start/ (debug) check_kernel: ... file is invalid (debug) try_decompress: looking for gunzip magic in /boot//vmlinuz-4.9.0-8-amd64 (debug) try_decompress: looking for unxz magic in /boot//vmlinuz-4.9.0-8-amd64 (debug) try_decompress: magic for unxz found at offset 18357:abcde (debug) check_kernel: ret=0 size=20170444 sections=10 warnings= (debug) check_kernel: ... file is valid (debug) try_decompress: decompressed with unxz successfully! Kernel image is Linux version 4.9.0-8-amd64 (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) ) #1 SMP Debian 4.9.144-3.1 (2019-02-19)

Hardware check

CVE-2017-5753 aka 'Spectre Variant 1, bounds check bypass'

CVE-2017-5715 aka 'Spectre Variant 2, branch target injection'

CVE-2017-5754 aka 'Variant 3, Meltdown, rogue data cache load'

CVE-2018-3640 aka 'Variant 3a, rogue system register read'

CVE-2018-3639 aka 'Variant 4, speculative store bypass'

CVE-2018-3615 aka 'Foreshadow (SGX), L1 terminal fault'

CVE-2018-3620 aka 'Foreshadow-NG (OS), L1 terminal fault'

CVE-2018-3646 aka 'Foreshadow-NG (VMM), L1 terminal fault'

SUMMARY: CVE-2017-5753:OK CVE-2017-5715:OK CVE-2017-5754:OK CVE-2018-3640:OK CVE-2018-3639:OK CVE-2018-3615:OK CVE-2018-3620:OK CVE-2018-3646:KO

(debug) variables at end of script: '|bp_harden=''|bp_harden_can_tell='1'|capabilities=' 12'|capabilities_ibrs_all='0'|capabilities_l1dflush_no='1'|capabilities_rdcl_no='0'|capabilities_rsba='1'|capabilities_ssb_no='0'|cpu_brand_prefix='I'|cpu_cpuid='198304'|cpu_family='6'|cpu_flush_cmd='1'|cpu_friendly_name='Intel(R) Xeon(R) CPU E5-2667 v2 @ 3.30GHz'|cpuid_arch_capabilities='1'|cpuid_ibpb='SPEC_CTRL'|cpuid_ibrs='SPEC_CTRL'|cpuid_sgx='0'|cpuid_spec_ctrl='1'|cpuid_ssbd='Intel SSBD'|cpu_mismatch='0'|cpu_model='58'|cpu_pcid='1'|cpu_stepping='0'|cpu_ucode='1069'|cpu_vendor='GenuineIntel'|cve='CVE-2018-3646'|dir='/proc/sys/kernel'|dmesg_grep='Kernel/User page tables isolation: enabled|Kernel page table isolation enabled|x86/pti: Unmapping kernel while in userspace|CPU features: detected( feature)?: Kernel page table isolation (KPTI)'|dmesg_grepped='[ 0.000000] Booting paravirtualized kernel on bare hardware'|echo_cmd_type='printf'|echo_cmd='/usr/bin/printf'|file='/sys/devices/system/cpu/vulnerabilities/l1tf'|final_summary=' CVE-2017-5753:OK CVE-2017-5715:OK CVE-2017-5754:OK CVE-2018-3640:OK CVE-2018-3639:OK CVE-2018-3615:OK CVE-2018-3620:OK CVE-2018-3646:KO'|global_critical='1'|global_unknown='0'|has_vmm='1'|i='1'|ibpb_can_tell='0'|ibpb_enabled='1'|ibpb_supported='IBPB found enabled in sysfs'|ibrs_can_tell='1'|ibrs_enabled='0'|ibrs_fw_enabled='1'|ibrs_supported='found IBRS_FW in sysfs'|idx_max_cpu='1'|insmod_cpuid='1'|insmod_msr='1'|is_cpu_vulnerable_cached='1'|kernel_err=''|kernel_ssbd_enabled='1'|kernel_ssb='found in /proc/self/status'|kernel='/tmp/kernel-as3PSd'|kerneltmp='/tmp/kernel-as3PSd'|kernel_version='Linux version 4.9.0-8-amd64 (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) ) #1 SMP Debian 4.9.144-3.1 (2019-02-19)'|kpti_can_tell='1'|kpti_enabled='1'|kpti_support='CONFIG_PAGE_TABLE_ISOLATION=y'|l1d_kernel='found flush_l1d in /proc/cpuinfo'|l1d_mode='-1'|mcedb_cache='/root/.mcedb'|mcedb_info='builtin MCExtractor DB v108 - 2019/04/18'|mcedb_source='/tmp/tmp.NasudOQ0v6/spectre-meltdown-checker.sh'|mitigated_processes='systemd-journald systemd-logind systemd-udevd'|model='45'|mode='silent'|msg=''|n='2'|nb_lfence='3'|ncpus='2'|nrpe_vuln=''|opt=''|opt_arch_prefix=''|opt_batch='0'|opt_batch_format='text'|opt_config='/boot/config-4.9.0-8-amd64'|opt_coreos='0'|opt_cve_all='1'|opt_cve_list=''|opt_explain='0'|opt_hw_only='0'|opt_kernel='/boot//vmlinuz-4.9.0-8-amd64'|opt_live='1'|opt_live_explicit='0'|opt_map='/proc/kallsyms'|opt_no_color='0'|opt_no_hw='0'|opt_no_sysfs='0'|opt_paranoid='0'|opt_sysfs_only='0'|opt_verbose='4'|opt_vmm='-1'|os='Linux'|parse_cpu_details_done='1'|pos='18357'|procfs='/proc'|pteinv_active='1'|pteinv_supported='1'|pvulnstatus_last_cve='CVE-2018-3646'|read_cpuid_value='0'|read_msr_value=' 12'|redhat_canonical_spectre='0'|regex='VMX:.*'|ret='0'|ret24='0'|ret25='0'|retpoline='1'|retpoline_compiler='1'|retpoline_compiler_reason='kernel reports full retpoline compilation'|rsb_filling='6Spectre V2 : Spectre v2 / SpectreRSB mitigation: Filling RSB on context switch'|smt_enabled='1'|spec_ctrl_msr='1'|status='UNK'|stepping='7'|supported_cve_list='CVE-2017-5753 CVE-2017-5715 CVE-2017-5754 CVE-2018-3640 CVE-2018-3639 CVE-2018-3615 CVE-2018-3620 CVE-2018-3646'|sys_interface_available='1'|tuple='I,0x000306A0,0x00000007,20110407'|ucode='7'|ucode_date='2011/04/07'|ucode_found='model 0x3a family 0x6 stepping 0x0 ucode 0x42d cpuid 0x306a0'|ucode_latest='latest version is 0x7 dated 2011/04/07 according to builtin MCExtractor DB v108 - 2019/04/18'|v1_mask_nospec='x86 64 bits array_index_mask_nospec'|val='0'|val_cap_msr=' 12'|variant1='0'|variant2='0'|variant3='0'|variant3a='0'|variant4='0'|variantl1tf='0'|variantl1tf_sgx='1'|vulnstatus='VULN'| Need more detailed information about mitigation options? Use --explain A false sense of security is worse than no security at all, see --disclaimer

speed47 commented 5 years ago

So after digging a bit into this part of the code, it seems that the logic is indeed flawed. The code tries to detect whether it's inside a VM or not (i.e. running under a hypervisor), but this is not what we need to know here: we need to know if we ARE running a hypervisor ourselves. I'm not sure there's actually a better way than just checking if we recognize a hypervisor in the currently running processes.

mweissen13 commented 5 years ago

I also cannot think of any better method of querying if we ARE running a hypervisor. Thank you for the fix. At least on all of my machines it does now work correctly without specifying "--vmm no".

hardfalcon commented 5 years ago

Checking whether libvirtd is running gives false positives as well, since libvirtd can also be used to run containers (which should not be affected by CVE-2018-3646 AFAIK) or may even be running without any real VMs actually configured/running.

Also, even if libvirtd is used to run KVM VMs, you'll still see the qemu processes that are started by libvirtd, so there's no need to check for libvirtd itself.

speed47 commented 5 years ago

It can at least manage LXC and Virtuozzo containers indeed, removed.

mattvw commented 5 years ago

I think this works much better now for detecting hypervisors correctly with L1TF. I've run into no issues with the fixes that have been made (including with the latest changes). I'll go ahead and close out this issue. Feel free to re-open @speed47 if necessary.

Thanks!!

ghost commented 5 years ago

tl;dr: --paranoid doesn't know L1TF is unconditionally enabled when no hypervisor is detected(true) and /sys says Mitigation: PTE Inversion, also when /proc/cmdline says l1tf=full,force.


without --paranoid:

CVE-2018-3646 aka 'Foreshadow-NG (VMM), L1 terminal fault'
* Information from the /sys interface: Mitigation: PTE Inversion
* This system is a host running a hypervisor:  NO 
* Mitigation 1 (KVM)
  * EPT is disabled:  N/A  (the kvm_intel module is not loaded)
* Mitigation 2
  * L1D flush is supported by kernel:  YES  (found flush_l1d in /proc/cpuinfo)
  * L1D flush enabled:  UNKNOWN  (unrecognized mode)
  * Hardware-backed L1D flush supported:  YES  (performance impact of the mitigation will be greatly reduced)
  * Hyper-Threading (SMT) is enabled:  NO 
> STATUS:  NOT VULNERABLE  (this system is not running a hypervisor)

The L1D flush enabled: UNKNOWN (unrecognized mode) coupled with --paranoid(see below) and * Information from the /sys interface: Mitigation: PTE Inversion yields > STATUS: VULNERABLE (L1D unconditional flushing should be enabled to fully mitigate the vulnerability)

CVE-2018-3646 aka 'Foreshadow-NG (VMM), L1 terminal fault'
* Information from the /sys interface: Mitigation: PTE Inversion
* This system is a host running a hypervisor:  YES  (paranoid mode)
* Mitigation 1 (KVM)
  * EPT is disabled:  N/A  (the kvm_intel module is not loaded)
* Mitigation 2
  * L1D flush is supported by kernel:  YES  (found flush_l1d in /proc/cpuinfo)
  * L1D flush enabled:  UNKNOWN  (unrecognized mode)
  * Hardware-backed L1D flush supported:  YES  (performance impact of the mitigation will be greatly reduced)
  * Hyper-Threading (SMT) is enabled:  NO 
> STATUS:  VULNERABLE  (L1D unconditional flushing should be enabled to fully mitigate the vulnerability)

the relevant code below doesn't check for PTE Inversion:

        if echo "$fullmsg" | grep -Eq -e 'Not affected' -e '(VMX:|L1D) (EPT disabled|vulnerable|flush not necessary)'; then     
          l1d_mode=0
          pstatus yellow NO
        elif echo "$fullmsg" | grep -Eq '(VMX:|L1D) conditional cache flushes'; then
          l1d_mode=1
          pstatus green YES "conditional flushes"
        elif echo "$fullmsg" | grep -Eq '(VMX:|L1D) cache flushes'; then
          l1d_mode=2
          pstatus green YES "unconditional flushes"
        else
          if is_xen_dom0; then
            l1d_xen_hardware=$(xl dmesg | grep 'Hardware features:' | grep 'L1D_FLUSH' | head -1)
            l1d_xen_hypervisor=$(xl dmesg | grep 'Xen settings:' | grep 'L1D_FLUSH' | head -1)
            l1d_xen_pv_domU=$(xl dmesg | grep 'PV L1TF shadowing:' | grep 'DomU enabled' | head -1)

            if [ -n "$l1d_xen_hardware" ] && [ -n "$l1d_xen_hypervisor" ] && [ -n "$l1d_xen_pv_domU" ]; then
              l1d_mode=5
              pstatus green YES "for XEN guests"
            elif [ -n "$l1d_xen_hardware" ] && [ -n "$l1d_xen_hypervisor" ]; then
              l1d_mode=4
              pstatus yellow YES "for XEN guests (HVM only)"
            elif [ -n "$l1d_xen_pv_domU" ]; then
              l1d_mode=3
              pstatus yellow YES "for XEN guests (PV only)"
            else
              l1d_mode=0
              pstatus yellow NO "for XEN guests"
            fi
          else
            l1d_mode=-1
            pstatus yellow UNKNOWN "unrecognized mode"
          fi

I'm unsure if this means PTE Inversion isn't good enough(of a mitigation) in this case or it's just not in the list above...

I am using l1tf=full,force though, and 5.1.5-g835365932f0d kernel:

$ cat /proc/cmdline BOOT_IMAGE=/boot/vmlinuz-linux-stable root=UUID=2b8b9ab8-7ac5-4586-aa42-d7ffb12de92a rw root_trim=yes rd.luks.allow-discards rd.luks.options=discard ipv6.disable=1 ipv6.disable_ipv6=1 ipv6.autoconf=0 loglevel=15 log_buf_len=16M ignore_loglevel printk.always_kmsg_dump=y printk.time=y printk.devkmsg=on mminit_loglevel=4 memory_corruption_check=1 fbcon=scrollback:4096k fbcon=font:ProFont6x11 net.ifnames=0 nolvm dobtrfs console=tty1 earlyprintk=vga audit=0 systemd.log_target=kmsg systemd.journald.forward_to_console=1 enforcing=0 udev.children-max=1256 rd.udev.children-max=1256 nohz=on oops=panic crashkernel=128M panic=0 psi=1 sysrq_always_enabled random.trust_cpu=off logo.nologo lpj=0 mce=bootlog reboot=force,cold noexec=on nohibernate scsi_mod.use_blk_mq=1 consoleblank=120 mitigations=auto,nosmt l1tf=full,force spec_store_bypass_disable=auto spectre_v2=auto spectre_v2_user=auto mds=full,nosmt rd.log=all noefi cpuidle.governor=teo zram.num_devices=3 zswap.enabled=0 zswap.same_filled_pages_enabled=1 zswap.compressor=zstd zswap.max_pool_percent=40 zswap.zpool=z3fold i915.alpha_support=1 i915.fastboot=1

from linux-stable/Documentation/admin-guide/hw-vuln/l1tf.rst:

  ============  =============================================================
  full    Provides all available mitigations for the L1TF
    vulnerability. Disables SMT and enables all mitigations in
    the hypervisors, i.e. unconditional L1D flushing

    SMT control and L1D flush control via the sysfs interface
    is still possible after boot.  Hypervisors will issue a
    warning when the first VM is started in a potentially
    insecure configuration, i.e. SMT enabled or L1D flush
    disabled.

  full,force  Same as 'full', but disables SMT and L1D flush runtime
    control. Implies the 'nosmt=force' command line option.
    (i.e. sysfs control of SMT is disabled.)

  flush   Leaves SMT enabled and enables the default hypervisor
    mitigation, i.e. conditional L1D flushing

    SMT control and L1D flush control via the sysfs interface
    is still possible after boot.  Hypervisors will issue a
    warning when the first VM is started in a potentially
    insecure configuration, i.e. SMT enabled or L1D flush
    disabled.

  flush,nosmt Disables SMT and enables the default hypervisor mitigation,
    i.e. conditional L1D flushing.

    SMT control and L1D flush control via the sysfs interface
    is still possible after boot.  Hypervisors will issue a
    warning when the first VM is started in a potentially
    insecure configuration, i.e. SMT enabled or L1D flush
    disabled.

  flush,nowarn  Same as 'flush', but hypervisors will not warn when a VM is
    started in a potentially insecure configuration.

  off   Disables hypervisor mitigations and doesn't emit any
    warnings.
    It also drops the swap size and available RAM limit restrictions                                                            
    on both hypervisor and bare metal.

Seems like --paranoid should still detect this as NOT vulnerable, right?

mattvw commented 4 years ago

Hi,

I'm re-opening this. The hypervisor check seems to now cause false positives for systems running RHEL 7.7 and have virtualization enabled but are NOT actually running a hypervisor. The systems have a "[kvm-irqfd-clean]" process which causes the script to think they running a hypervisor, but in fact they are not. This is then causing them to show up as vulnerable to CVE-2018-12207 (since they also don't have the kernel update for it, even though they don't really need it).

[root@system ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.7 (Maipo)
[root@system ~]# pgrep kvm
1862
[root@system ~]# ps -u -p 1862
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      1862  0.0  0.0      0     0 ?        S<   13:03   0:00 [kvm-irqfd-clean]
[root@system ~]#

If you'd rather I move this to a new issue, I can definitely do that too.

Let me know if there's any other info I can provide.

Here's the script output with a bunch of v's:

[root@system ~]# ./spectre-meltdown-checker.sh -v -v -v
Spectre and Meltdown mitigation detection tool v0.43

(debug) cpuid: leaf1 on cpu0, eax-ebx-ecx-edx:      198372    2099200 2143216639 3219913727
(debug) cpuid: wanted register (1) has value 198372 aka 000306e4
(debug) cpuid: shifted value by 0 is 198372 aka 306e4
(debug) cpuid: after AND 0xFFFFFFFF, final value is 198372 aka 306e4
Checking for vulnerabilities on current system
Kernel is Linux 3.10.0-1062.el7.x86_64 #1 SMP Thu Jul 18 20:25:13 UTC 2019 x86_64
CPU is Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz
(debug) found opt_kernel=/vmlinuz-3.10.0-1062.el7.x86_64 in /proc/cmdline
(debug) opt_kernel is now /boot//vmlinuz-3.10.0-1062.el7.x86_64
Will use kernel image /boot//vmlinuz-3.10.0-1062.el7.x86_64
Will use kconfig /boot/config-3.10.0-1062.el7.x86_64
Will use System.map file /proc/kallsyms
(debug) check_kernel: ret=0 size=6730032 sections=0 warnings=readelf: /boot//vmlinuz-3.10.0-1062.el7.x86_64: Error: Not an ELF file - it has the wrong magic bytes at the start/
(debug) check_kernel: ... file is invalid
(debug) extract_kernel: pass 1 normal mode
(debug) try_decompress: looking for gunzip magic in /boot//vmlinuz-3.10.0-1062.el7.x86_64
(debug) try_decompress: magic for gunzip found at offset 18357:xy
(debug) check_kernel: ret=0 size=34717728 sections=11 warnings=
(debug) check_kernel: ... file is valid
(debug) try_decompress: decompressed with gunzip successfully!
Kernel image is Linux version 3.10.0-1062.el7.x86_64 (mockbuild@x86-040.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Thu Jul 18 20:25:13 UTC 2019

Hardware check
* Hardware support (CPU microcode) for mitigation techniques
  * Indirect Branch Restricted Speculation (IBRS)
    * SPEC_CTRL MSR is available: (debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
(debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
(debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
(debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
(debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
(debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
(debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
(debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
(debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
(debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
(debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
(debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
(debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
(debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
(debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
(debug) read_msr: using perl on 0x48
(debug) read_msr: MSR=0x48 value is 0
 YES 
    * CPU indicates IBRS capability: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0        641          0 2617246720
(debug) cpuid: wanted register (4) has value 2617246720 aka 9c000400
(debug) cpuid: shifted value by 26 is 39 aka 27
(debug) cpuid: after AND 1, final value is 1 aka 1
(debug) cpuid: wanted 1 and got 1
 YES  (SPEC_CTRL feature bit)
  * Indirect Branch Prediction Barrier (IBPB)
    * PRED_CMD MSR is available: (debug) write_msr: using perl
(debug) write_msr: for cpu 0 on msr 0x49, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 1 on msr 0x49, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 2 on msr 0x49, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 3 on msr 0x49, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 4 on msr 0x49, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 5 on msr 0x49, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 6 on msr 0x49, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 7 on msr 0x49, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 8 on msr 0x49, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 9 on msr 0x49, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 10 on msr 0x49, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 11 on msr 0x49, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 12 on msr 0x49, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 13 on msr 0x49, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 14 on msr 0x49, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 15 on msr 0x49, ret=0
 YES 
    * CPU indicates IBPB capability:  YES  (SPEC_CTRL feature bit)
  * Single Thread Indirect Branch Predictors (STIBP)
    * SPEC_CTRL MSR is available:  YES 
    * CPU indicates STIBP capability: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0        641          0 2617246720
(debug) cpuid: wanted register (4) has value 2617246720 aka 9c000400
(debug) cpuid: shifted value by 27 is 19 aka 13
(debug) cpuid: after AND 1, final value is 1 aka 1
(debug) cpuid: wanted 1 and got 1
 YES  (Intel STIBP feature bit)
  * Speculative Store Bypass Disable (SSBD)
    * CPU indicates SSBD capability: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0        641          0 2617246720
(debug) cpuid: wanted register (4) has value 2617246720 aka 9c000400
(debug) cpuid: shifted value by 31 is 1 aka 1
(debug) cpuid: after AND 1, final value is 1 aka 1
(debug) cpuid: wanted 1 and got 1
 YES  (Intel SSBD)
  * L1 data cache invalidation
    * FLUSH_CMD MSR is available: (debug) write_msr: using perl
(debug) write_msr: for cpu 0 on msr 0x10b, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 1 on msr 0x10b, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 2 on msr 0x10b, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 3 on msr 0x10b, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 4 on msr 0x10b, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 5 on msr 0x10b, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 6 on msr 0x10b, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 7 on msr 0x10b, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 8 on msr 0x10b, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 9 on msr 0x10b, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 10 on msr 0x10b, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 11 on msr 0x10b, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 12 on msr 0x10b, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 13 on msr 0x10b, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 14 on msr 0x10b, ret=0
(debug) write_msr: using perl
(debug) write_msr: for cpu 15 on msr 0x10b, ret=0
 YES 
    * CPU indicates L1D flush capability: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0        641          0 2617246720
(debug) cpuid: wanted register (4) has value 2617246720 aka 9c000400
(debug) cpuid: shifted value by 28 is 9 aka 9
(debug) cpuid: after AND 1, final value is 1 aka 1
(debug) cpuid: wanted 1 and got 1
 YES  (L1D flush feature bit)
  * Microarchitectural Data Sampling
    * VERW instruction is available: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0        641          0 2617246720
(debug) cpuid: wanted register (4) has value 2617246720 aka 9c000400
(debug) cpuid: shifted value by 10 is 2555905 aka 270001
(debug) cpuid: after AND 1, final value is 1 aka 1
(debug) cpuid: wanted 1 and got 1
 YES  (MD_CLEAR feature bit)
  * Enhanced IBRS (IBRS_ALL)
    * CPU indicates ARCH_CAPABILITIES MSR availability: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0        641          0 2617246720
(debug) cpuid: wanted register (4) has value 2617246720 aka 9c000400
(debug) cpuid: shifted value by 29 is 4 aka 4
(debug) cpuid: after AND 1, final value is 0 aka 0
(debug) cpuid: wanted 1 and got 0
 NO 
    * ARCH_CAPABILITIES MSR advertises IBRS_ALL capability:  NO 
  * CPU explicitly indicates not being vulnerable to Meltdown/L1TF (RDCL_NO):  NO 
  * CPU explicitly indicates not being vulnerable to Variant 4 (SSB_NO):  NO 
  * CPU/Hypervisor indicates L1D flushing is not necessary on this system:  NO 
  * Hypervisor indicates host CPU might be vulnerable to RSB underflow (RSBA):  NO 
  * CPU explicitly indicates not being vulnerable to Microarchitectural Data Sampling (MDS_NO):  NO 
  * CPU explicitly indicates not being vulnerable to TSX Asynchronous Abort (TAA_NO):  NO 
  * CPU explicitly indicates not being vulnerable to iTLB Multihit (PSCHANGE_MSC_NO):  NO 
  * CPU explicitly indicates having MSR for TSX control (TSX_CTRL_MSR):  NO 
  * CPU supports Transactional Synchronization Extensions (TSX): (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0        641          0 2617246720
(debug) cpuid: wanted register (2) has value 641 aka 00000281
(debug) cpuid: shifted value by 11 is 0 aka 0
(debug) cpuid: after AND 1, final value is 0 aka 0
(debug) cpuid: wanted 1 and got 0
 NO 
  * CPU supports Software Guard Extensions (SGX): (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0        641          0 2617246720
(debug) cpuid: wanted register (2) has value 641 aka 00000281
(debug) cpuid: shifted value by 2 is 160 aka a0
(debug) cpuid: after AND 1, final value is 0 aka 0
(debug) cpuid: wanted 1 and got 0
 NO 
  * CPU microcode is known to cause stability problems: (debug) is_ucode_blacklisted: no (62/4/1070)
 NO  (model 0x3e family 0x6 stepping 0x4 ucode 0x42e cpuid 0x306e4)
  * CPU microcode is the latest known available version: (debug) is_latest_known_ucode: with cpuid 198372 has ucode 1070, last known is 1070 from 2019/03/14
 YES  (latest version is 0x42e dated 2019/03/14 according to builtin firmwares DB v130.20191104+i20191027)
* CPU vulnerability to the speculative execution attack variants
  * Vulnerable to CVE-2017-5753 (Spectre Variant 1, bounds check bypass): (debug) is_cpu_vulnerable: cpu not affected by TSX Asynhronous Abort
(debug) is_cpu_vulnerable: intel family 6 is vuln to l1tf
(debug) is_cpu_vulnerable: intel family 6 is vuln to itlbmh
(debug) is_cpu_vulnerable: temp results are <> <> <> <> <> <vuln>
(debug) is_cpu_vulnerable: final results are <0> <0> <0> <0> <0> <0> <1>
 YES 
  * Vulnerable to CVE-2017-5715 (Spectre Variant 2, branch target injection):  YES 
  * Vulnerable to CVE-2017-5754 (Variant 3, Meltdown, rogue data cache load):  YES 
  * Vulnerable to CVE-2018-3640 (Variant 3a, rogue system register read):  YES 
  * Vulnerable to CVE-2018-3639 (Variant 4, speculative store bypass):  YES 
  * Vulnerable to CVE-2018-3615 (Foreshadow (SGX), L1 terminal fault):  NO 
  * Vulnerable to CVE-2018-3620 (Foreshadow-NG (OS), L1 terminal fault):  YES 
  * Vulnerable to CVE-2018-3646 (Foreshadow-NG (VMM), L1 terminal fault):  YES 
  * Vulnerable to CVE-2018-12126 (Fallout, microarchitectural store buffer data sampling (MSBDS)):  YES 
  * Vulnerable to CVE-2018-12130 (ZombieLoad, microarchitectural fill buffer data sampling (MFBDS)):  YES 
  * Vulnerable to CVE-2018-12127 (RIDL, microarchitectural load port data sampling (MLPDS)):  YES 
  * Vulnerable to CVE-2019-11091 (RIDL, microarchitectural data sampling uncacheable memory (MDSUM)):  YES 
  * Vulnerable to CVE-2019-11135 (ZombieLoad V2, TSX Asynchronous Abort (TAA)):  NO 
  * Vulnerable to CVE-2018-12207 (No eXcuses, iTLB Multihit, machine check exception on page size changes (MCEPSC)):  YES 

CVE-2017-5753 aka 'Spectre Variant 1, bounds check bypass'
* Mitigated according to the /sys interface:  YES  (Mitigation: Load fences, __user pointer sanitization)
(debug) sys_interface_check: /sys/devices/system/cpu/vulnerabilities/spectre_v1=Mitigation: Load fences, __user pointer sanitization (re=.*)
* Kernel has array_index_mask_nospec:  YES  (1 occurrence(s) found of x86 64 bits array_index_mask_nospec())
* Kernel has the Red Hat/Ubuntu patch: (debug) found redhat/canonical version of the variant2 patch (implies variant1)
 YES 
* Kernel has mask_nospec64 (arm64):  NO 
* Checking count of LFENCE instructions following a jump in kernel...  YES  (42 jump-then-lfence instructions found, which is >= 30 (heuristic))
> STATUS:  NOT VULNERABLE  (Mitigation: Load fences, __user pointer sanitization)

CVE-2017-5715 aka 'Spectre Variant 2, branch target injection'
* Mitigated according to the /sys interface:  YES  (Mitigation: Full retpoline, IBPB)
(debug) sys_interface_check: /sys/devices/system/cpu/vulnerabilities/spectre_v2=Mitigation: Full retpoline, IBPB (re=.*)
* Mitigation 1
(debug) ibrs: /sys/kernel/debug/ibrs_enabled file doesn't exist
(debug) ibrs: found /sys/kernel/debug/x86/ibrs_enabled=0
(debug) ibpb: found /sys/kernel/debug/x86/ibpb_enabled=1
(debug) ibpb: found enabled in sysfs
  * Kernel is compiled with IBRS support:  YES  (/sys/kernel/debug/x86/ibrs_enabled exists)
    * IBRS enabled and active:  NO 
  * Kernel is compiled with IBPB support:  YES  (/sys/kernel/debug/x86/ibpb_enabled exists)
    * IBPB enabled and active:  YES 
* Mitigation 2
  * Kernel has branch predictor hardening (arm):  NO 
  * Kernel compiled with retpoline option:  YES 
(debug) retpoline: found CONFIG_RETPOLINE=y in /boot/config-3.10.0-1062.el7.x86_64
    * Kernel compiled with a retpoline-aware compiler:  YES  (kernel reports full retpoline compilation)
(debug) retpoline: found /sys/kernel/debug/x86/retp_enabled=1
    * Retpoline is enabled:  YES 
    * Local gcc is retpoline-aware:  YES 
  * Kernel supports RSB filling:  NO 
> STATUS:  NOT VULNERABLE  (Full retpoline + IBPB are mitigating the vulnerability)

CVE-2017-5754 aka 'Variant 3, Meltdown, rogue data cache load'
* Mitigated according to the /sys interface:  YES  (Mitigation: PTI)
(debug) sys_interface_check: /sys/devices/system/cpu/vulnerabilities/meltdown=Mitigation: PTI (re=.*)
* Kernel supports Page Table Isolation (PTI): (debug) kpti_support: found option 'CONFIG_PAGE_TABLE_ISOLATION=y' in /boot/config-3.10.0-1062.el7.x86_64
 YES  (found 'CONFIG_PAGE_TABLE_ISOLATION=y')
  * PTI enabled and active: (debug) kpti_enabled: file /sys/kernel/debug/x86/pti_enabled exists and says: 1
 YES 
  * Reduced performance impact of PTI: (debug) cpuid: leaf7 on cpu0, eax-ebx-ecx-edx:           0        641          0 2617246720
(debug) cpuid: wanted register (2) has value 641 aka 00000281
(debug) cpuid: shifted value by 10 is 0 aka 0
(debug) cpuid: after AND 1, final value is 0 aka 0
(debug) cpuid: wanted 1 and got 0
 YES  (CPU supports PCID, performance impact of PTI will be reduced)
* Running as a Xen PV DomU:  NO 
> STATUS:  NOT VULNERABLE  (Mitigation: PTI)

CVE-2018-3640 aka 'Variant 3a, rogue system register read'
* CPU microcode mitigates the vulnerability:  YES 
> STATUS:  NOT VULNERABLE  (your CPU microcode mitigates the vulnerability)

CVE-2018-3639 aka 'Variant 4, speculative store bypass'
* Mitigated according to the /sys interface:  YES  (Mitigation: Speculative Store Bypass disabled via prctl and seccomp)
(debug) sys_interface_check: /sys/devices/system/cpu/vulnerabilities/spec_store_bypass=Mitigation: Speculative Store Bypass disabled via prctl and seccomp (re=.*)
* Kernel supports disabling speculative store bypass (SSB): (debug) found Speculation.Store.Bypass: in /proc/self/status
 YES  (found in /proc/self/status)
* SSB mitigation is enabled and active:  YES  (per-thread through prctl)
* SSB mitigation currently active for selected processes:  NO  (no process found using SSB mitigation through prctl)
> STATUS:  NOT VULNERABLE  (Mitigation: Speculative Store Bypass disabled via prctl and seccomp)

CVE-2018-3615 aka 'Foreshadow (SGX), L1 terminal fault'
* CPU microcode mitigates the vulnerability:  N/A 
> STATUS:  NOT VULNERABLE  (your CPU vendor reported your CPU model as not vulnerable)

CVE-2018-3620 aka 'Foreshadow-NG (OS), L1 terminal fault'
* Mitigated according to the /sys interface:  YES  (Mitigation: PTE Inversion; VMX: conditional cache flushes, SMT disabled)
(debug) sys_interface_check: /sys/devices/system/cpu/vulnerabilities/l1tf=Mitigation: PTE Inversion; VMX: conditional cache flushes, SMT disabled (re=.*)
* Kernel supports PTE inversion:  YES  (found in kernel image)
(debug) pteinv: found pte inversion evidence in kernel image
* PTE inversion enabled and active:  YES 
> STATUS:  NOT VULNERABLE  (Mitigation: PTE Inversion; VMX: conditional cache flushes, SMT disabled)

CVE-2018-3646 aka 'Foreshadow-NG (VMM), L1 terminal fault'
* Information from the /sys interface: Mitigation: PTE Inversion; VMX: conditional cache flushes, SMT disabled
* This system is a host running a hypervisor:  YES 
* Mitigation 1 (KVM)
  * EPT is disabled:  NO 
* Mitigation 2
  * L1D flush is supported by kernel:  YES  (found flush_l1d in /proc/cpuinfo)
  * L1D flush enabled:  YES  (conditional flushes)
  * Hardware-backed L1D flush supported:  YES  (performance impact of the mitigation will be greatly reduced)
  * Hyper-Threading (SMT) is enabled:  NO 
> STATUS:  NOT VULNERABLE  (L1D flushing is enabled and mitigates the vulnerability)

CVE-2018-12126 aka 'Fallout, microarchitectural store buffer data sampling (MSBDS)'
* Mitigated according to the /sys interface:  YES  (Mitigation: Clear CPU buffers; SMT disabled)
(debug) sys_interface_check: /sys/devices/system/cpu/vulnerabilities/mds=Mitigation: Clear CPU buffers (re=^[^;]+)
* Kernel supports using MD_CLEAR mitigation:  YES  (md_clear found in /proc/cpuinfo)
* Kernel mitigation is enabled and active:  YES 
* SMT is either mitigated or disabled:  YES 
> STATUS:  NOT VULNERABLE  (Your microcode and kernel are both up to date for this mitigation, and mitigation is enabled)

CVE-2018-12130 aka 'ZombieLoad, microarchitectural fill buffer data sampling (MFBDS)'
* Mitigated according to the /sys interface:  YES  (Mitigation: Clear CPU buffers; SMT disabled)
(debug) sys_interface_check: /sys/devices/system/cpu/vulnerabilities/mds=Mitigation: Clear CPU buffers (re=^[^;]+)
* Kernel supports using MD_CLEAR mitigation:  YES  (md_clear found in /proc/cpuinfo)
* Kernel mitigation is enabled and active:  YES 
* SMT is either mitigated or disabled:  YES 
> STATUS:  NOT VULNERABLE  (Your microcode and kernel are both up to date for this mitigation, and mitigation is enabled)

CVE-2018-12127 aka 'RIDL, microarchitectural load port data sampling (MLPDS)'
* Mitigated according to the /sys interface:  YES  (Mitigation: Clear CPU buffers; SMT disabled)
(debug) sys_interface_check: /sys/devices/system/cpu/vulnerabilities/mds=Mitigation: Clear CPU buffers (re=^[^;]+)
* Kernel supports using MD_CLEAR mitigation:  YES  (md_clear found in /proc/cpuinfo)
* Kernel mitigation is enabled and active:  YES 
* SMT is either mitigated or disabled:  YES 
> STATUS:  NOT VULNERABLE  (Your microcode and kernel are both up to date for this mitigation, and mitigation is enabled)

CVE-2019-11091 aka 'RIDL, microarchitectural data sampling uncacheable memory (MDSUM)'
* Mitigated according to the /sys interface:  YES  (Mitigation: Clear CPU buffers; SMT disabled)
(debug) sys_interface_check: /sys/devices/system/cpu/vulnerabilities/mds=Mitigation: Clear CPU buffers (re=^[^;]+)
* Kernel supports using MD_CLEAR mitigation:  YES  (md_clear found in /proc/cpuinfo)
* Kernel mitigation is enabled and active:  YES 
* SMT is either mitigated or disabled:  YES 
> STATUS:  NOT VULNERABLE  (Your microcode and kernel are both up to date for this mitigation, and mitigation is enabled)

CVE-2019-11135 aka 'ZombieLoad V2, TSX Asynchronous Abort (TAA)'
* TAA mitigation is supported by kernel:  NO 
* TAA mitigation enabled and active:  NO  (tsx_async_abort not found in sysfs hierarchy)
> STATUS:  NOT VULNERABLE  (your CPU vendor reported your CPU model as not vulnerable)

CVE-2018-12207 aka 'No eXcuses, iTLB Multihit, machine check exception on page size changes (MCEPSC)'
* This system is a host running a hypervisor:  YES 
* iTLB Multihit mitigation is supported by kernel:  NO 
* iTLB Multihit mitigation enabled and active:  NO  (itlb_multihit not found in sysfs hierarchy)
> STATUS:  VULNERABLE  (Your kernel doesn't support iTLB Multihit mitigation, update it)

> SUMMARY: CVE-2017-5753:OK CVE-2017-5715:OK CVE-2017-5754:OK CVE-2018-3640:OK CVE-2018-3639:OK CVE-2018-3615:OK CVE-2018-3620:OK CVE-2018-3646:OK CVE-2018-12126:OK CVE-2018-12130:OK CVE-2018-12127:OK CVE-2019-11091:OK CVE-2019-11135:OK CVE-2018-12207:KO

(debug) variables at end of script: '|bp_harden=|bp_harden_can_tell=1|builtin_dbversion=v130.20191104+i20191027|capabilities_ibrs_all=0|capabilities_l1dflush_no=0|capabilities_mds_no=0|capabilities_pschange_msc_no=0|capabilities_rdcl_no=0|capabilities_rsba=0|capabilities_ssb_no=0|capabilities_taa_no=0|capabilities_tsx_ctrl_msr=0|cpu_brand_prefix=I|cpu_cpuid=198372|cpu_family=6|cpu_flush_cmd=1|cpu_friendly_name='Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz'|cpuid_arch_capabilities=0|cpuid_ibpb=SPEC_CTRL|cpuid_ibrs=SPEC_CTRL|cpuid_l1df=1|cpuid_md_clear=1|cpuid_rtm=0|cpuid_sgx=0|cpuid_spec_ctrl=1|cpuid_ssbd='Intel SSBD'|cpu_mismatch=0|cpu_model=62|cpu_pcid=1|cpu_stepping=4|cpu_ucode=1070|cpu_vendor=GenuineIntel|cve=CVE-2018-12207|dir=/sys/kernel/debug/x86|dmesg_grep='Kernel/User page tables isolation: enabled|Kernel page table isolation enabled|x86/pti: Unmapping kernel while in userspace|CPU features: detected( feature)?: Kernel page table isolation \(KPTI\)'|echo_cmd=printf|echo_cmd_type=printf|file=/sys/devices/system/cpu/vulnerabilities/itlb_multihit|final_summary=' CVE-2017-5753:OK CVE-2017-5715:OK CVE-2017-5754:OK CVE-2018-3640:OK CVE-2018-3639:OK CVE-2018-3615:OK CVE-2018-3620:OK CVE-2018-3646:OK CVE-2018-12126:OK CVE-2018-12130:OK CVE-2018-12127:OK CVE-2019-11091:OK CVE-2019-11135:OK CVE-2018-12207:KO'|fullmsg=|global_critical=1|global_unknown=0|has_vmm=1|i=15|ibpb_can_tell=0|ibpb_enabled=1|ibpb_supported='/sys/kernel/debug/x86/ibpb_enabled exists'|ibrs_can_tell=1|ibrs_enabled=0|ibrs_supported='/sys/kernel/debug/x86/ibrs_enabled exists'|idx_max_cpu=15|is_cpu_vulnerable_cached=1|kernel_cmdline='BOOT_IMAGE=/vmlinuz-3.10.0-1062.el7.x86_64 root=UUID=c0c8246e-fe50-4cf2-8d37-4bf8ea7481f0 ro crashkernel=auto ipv6.disable=1 console=ttyS0,115200n8r acpi_pad.disable=1'|kernel_err=|kernel_itlbmh=|kernel_md_clear_can_tell=1|kernel_md_clear='md_clear found in /proc/cpuinfo'|kernel_ssbd_enabled=1|kernel_ssb='found in /proc/self/status'|kernel_taa=|kernel=/tmp/kernel-bfe0jW|kerneltmp=/tmp/kernel-bfe0jW|kernel_version='Linux version 3.10.0-1062.el7.x86_64 (mockbuild@x86-040.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Thu Jul 18 20:25:13 UTC 2019'|kpti_can_tell=1|kpti_enabled=1|kpti_support=CONFIG_PAGE_TABLE_ISOLATION=y|l1d_kernel='found flush_l1d in /proc/cpuinfo'|l1d_mode=1|mcedb_cache=/root/.mcedb|mcedb_info='builtin firmwares DB v130.20191104+i20191027'|mcedb_source=./spectre-meltdown-checker.sh|mds_mitigated=1|mds_smt_mitigated=1|mitigated_processes=|mode=|model=45|msg=|mymsg='Your microcode and kernel are both up to date for this mitigation, and mitigation is enabled'|mystatus=OK|n=16|nb_lfence=42|ncpus=16|nrpe_vuln=|opt=|opt_arch_prefix=|opt_batch=0|opt_batch_format=text|opt_config=/boot/config-3.10.0-1062.el7.x86_64|opt_coreos=0|opt_cve_all=1|opt_cve_list=|opt_explain=0|opt_hw_only=0|opt_kernel=/boot//vmlinuz-3.10.0-1062.el7.x86_64|opt_live=1|opt_map=/proc/kallsyms|opt_mock=1|opt_no_color=0|opt_no_hw=0|opt_no_sysfs=0|opt_paranoid=0|opt_sysfs_only=0|opt_verbose=4|opt_vmm=-1|os=Linux|parse_cpu_details_done=1|pass=1|pos=18357|procfs=/proc|pteinv_active=1|pteinv_supported=1|pvulnstatus_last_cve=CVE-2018-12207|read_cpuid_value=0|read_msr_value=0|redhat_canonical_spectre=1|regex=|ret=1|ret24=0|ret25=0|retp_enabled=1|retpoline=1|retpoline_compiler=1|retpoline_compiler_reason='kernel reports full retpoline compilation'|rsb_filling=|smt_enabled=1|spec_ctrl_msr=1|specex_knob_dir=/sys/kernel/debug/x86|status=UNK|stepping=7|supported_cve_list='CVE-2017-5753 CVE-2017-5715 CVE-2017-5754 CVE-2018-3640 CVE-2018-3639 CVE-2018-3615 CVE-2018-3620 CVE-2018-3646 CVE-2018-12126 CVE-2018-12130 CVE-2018-12127 CVE-2019-11091 CVE-2019-11135 CVE-2018-12207'|sys_interface_available=0|tuple=I,0x000306E4,0x0000042E,20190314|ucode=1070|ucode_date=2019/03/14|ucode_found='model 0x3e family 0x6 stepping 0x4 ucode 0x42e cpuid 0x306e4'|ucode_latest='latest version is 0x42e dated 2019/03/14 according to builtin firmwares DB v130.20191104+i20191027'|v1_lfence=1|v1_mask_nospec='x86 64 bits array_index_mask_nospec'|val=0|variant1=0|variant2=0|variant3=0|variant3a=0|variant4=0|variant_itlbmh=0|variantl1tf=0|variantl1tf_sgx=1|variant_mdsum=0|variant_mfbds=0|variant_mlpds=0|variant_msbds=0|variant_taa=1|vulnstatus=VULN|

To mock this CPU, set those vars:  SMC_MOCK_CMDLINE='BOOT_IMAGE=/vmlinuz-3.10.0-1062.el7.x86_64 root=UUID=c0c8246e-fe50-4cf2-8d37-4bf8ea7481f0 ro crashkernel=auto ipv6.disable=1 console=ttyS0,115200n8r acpi_pad.disable=1' SMC_MOCK_CPU_FAMILY='6' SMC_MOCK_CPU_FRIENDLY_NAME='Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz' SMC_MOCK_CPUID_1=' 198372 2099200 2143216639 3219913727' SMC_MOCK_CPUID_7=' 0 641 0 2617246720' SMC_MOCK_CPUINFO='H4sIABuW7l0AA+2bT6vjNhDAz+tPMccWWmPJsuPsqbSU3VIKpVDozciykggsSyspfsn79B057y2FZ8OjPtRQHWJb/0bjkfRDGY2tM0J6b9yHj1Bkkxx741rVY+qTHK9qlL+MQQ6ZsFc4ca2GO5bUmTa9HD7ER/p4hpFriem59jd/fAt/STPG+0+//wk/V9/TuipgovAD0LwuPn1+znyQ1qrxjI1YppVAPVBQ1OLGqJw7/O3zc+yDUEpzykgmuLhI8Oo5VqMFawr49cfMXu5eCT7ArHWRedUNKNdjosmEcTIWzCVRZsx4FHGrxGuJGlVQKOIlL2ad7DWW3aWPj628CWmDMuNLHspSPQxyQjugimX2ZL9WHzj2jglsB5OW0EuwXkLwArR3YLkELSSIWzN3CF5a0MFhyTmWcBDaTFgtxGZlDWI4DVd/gT544MIq0PoGpxuK8igWfxQvcAkQNNgOc+4e7YFjcgPbW0nOHThsKywMGg0w+sDH0EZ1uBOX1kp30mYEKzsPHfbhpG3PxvQwGjvALRhrBnO+YxKbGvtoObeKF5D8jDd8VzsqsGLQ1+FL/wW1lb5mgJJVMA563wqUNqHqHn/SR3Wj4viKaApSY0cWTdALfAkcBOjREFjIWvK4UbjR2VzWWDGGaM62l7zHwZZtUFo64NLDzfNJAp/QQqQW+OKOjzhQ/HJq8e2l7UDFOdrGyYeCux5U5zxesMQHvAGq0foL780TTKNWcBrkzTplnAp3FBBgsqjeyZ99x6P9NQ6fdPqla4MV+nDBDJx3HC0ch3FA66Jhdd+KQXIcNytFK4IbXpR5dDyPcjuQPuvM2Whl40StSHPIDzR7nQQv079mj+XQ8kGdRy3H8MjkfY8T3M/VYnNWQ6ew69dV8h2w5pEzKReufMiseULTaT7iMEY5H7PM/gMKZK9QKIq8ro4boUBWoUDfQoEmKCQoJCjMK2GnUCBl3pTFRijQVSiwt1BgCQoJCgkKKKDcMRTKim2EQrkKhfotFOoEhQSFBIV5ce4TCuR4zJu62ggFtgqF5i0UmgSFBIUEhdj/TqEQfQoF3bpTqFahQBY8jSS5GhMWEhbcvNz3iYWqOuas3upVqNexsOBrJMnZmLCQsBCxcNgpFtiB5GVTb8TCYR0LC95GktyNCQsJC25eKvvEQk3KnFbvwwL5F9EK5cJuoUy7hYSFvWDhGBfNf4aF4z6xQKuqyRmlG7GwHq9QLuwWyrRbSFhIWHAPN9suuUCaps7rZisX1kMWyoXjyTKdTyYuJC7MXNhrfOOBFHl5eN8B5ToX1qMWyoUTyjIdUSYuJC7MXNhpiCOtYuDCOz+GWOfCeuACWzijZOmMMnEhccE9pvY+uVAc65wdtv6PWI9dYAtuR5bcjokLiQszF3Ya6EhpFY8j3ved1DoX1oMX2NI3EcnvmLiQuDBzYa+xjuxwzEm9db+wHr3AFvyOLPkdExf+v1z4G3KzGYJsQQAA' SMC_MOCK_CPU_MODEL='62' SMC_MOCK_CPU_STEPPING='4' SMC_MOCK_CPU_UCODE='0x42e' SMC_MOCK_CPU_VENDOR='GenuineIntel' SMC_MOCK_RDMSR_0x48='0' SMC_MOCK_SYSFS_itlb_multihit_RET=1 SMC_MOCK_SYSFS_l1tf='Mitigation: PTE Inversion; VMX: conditional cache flushes, SMT disabled' SMC_MOCK_SYSFS_mds='Mitigation: Clear CPU buffers; SMT disabled' SMC_MOCK_SYSFS_meltdown='Mitigation: PTI' SMC_MOCK_SYSFS_spec_store_bypass='Mitigation: Speculative Store Bypass disabled via prctl and seccomp' SMC_MOCK_SYSFS_spectre_v1='Mitigation: Load fences, __user pointer sanitization' SMC_MOCK_SYSFS_spectre_v2='Mitigation: Full retpoline, IBPB' SMC_MOCK_SYSFS_tsx_async_abort_RET=1 SMC_MOCK_WRMSR_0x10b_RET=0 SMC_MOCK_WRMSR_0x49_RET=0
Need more detailed information about mitigation options? Use --explain
A false sense of security is worse than no security at all, see --disclaimer
[root@system ~]#
mattvw commented 4 years ago

Sorry, this appears to not be specific to RHEL 7.7 either, as I'm now seeing RHEL 7.6 systems (with virtualization enabled but NOT running a hypervisor) have this process as well. Sorry I didn't catch this previously...

speed47 commented 4 years ago

Thanks for the report. I added some code to ignore the kernel threads for the hypervisor search. Can you try the vmmkthreads branch?

mattvw commented 4 years ago

@speed47: Yes, the script is working correctly now with those changes (using the vmmkthreads branch). I assume that this be moved to master then? Thank you!

speed47 commented 4 years ago

Sure, was waiting for your confirmation before merging ;)

mattvw commented 4 years ago

Thank you very much!!