1
0
mirror of https://github.com/speed47/spectre-meltdown-checker synced 2024-12-23 04:43:37 +01:00

fix: don't override ibrs/ibpb results with later tests

This commit is contained in:
Stéphane Lesimple 2018-04-05 22:04:20 +02:00
parent 89c2e0fb21
commit b77fb0f226

View File

@ -1923,20 +1923,20 @@ check_variant2_linux()
# when IBPB is enabled on 4.15+, we can see it in sysfs # when IBPB is enabled on 4.15+, we can see it in sysfs
if grep -q ', IBPB' "/sys/devices/system/cpu/vulnerabilities/spectre_v2"; then if grep -q ', IBPB' "/sys/devices/system/cpu/vulnerabilities/spectre_v2"; then
_debug "ibpb: found enabled in sysfs" _debug "ibpb: found enabled in sysfs"
ibpb_supported='IBPB found enabled in sysfs' [ -z "$ibpb_supported" ] && ibpb_supported='IBPB found enabled in sysfs'
ibpb_enabled=1 [ -z "$ibpb_enabled" ] && ibpb_enabled=1
fi fi
# when IBRS_FW is enabled on 4.15+, we can see it in sysfs # when IBRS_FW is enabled on 4.15+, we can see it in sysfs
if grep -q ', IBRS_FW' "/sys/devices/system/cpu/vulnerabilities/spectre_v2"; then if grep -q ', IBRS_FW' "/sys/devices/system/cpu/vulnerabilities/spectre_v2"; then
_debug "ibrs: found IBRS_FW in sysfs" _debug "ibrs: found IBRS_FW in sysfs"
ibrs_supported='found IBRS_FW in sysfs' [ -z "$ibrs_supported" ] && ibrs_supported='found IBRS_FW in sysfs'
ibrs_fw_enabled=1 ibrs_fw_enabled=1
fi fi
# when IBRS is enabled on 4.15+, we can see it in sysfs # when IBRS is enabled on 4.15+, we can see it in sysfs
if grep -q 'Indirect Branch Restricted Speculation' "/sys/devices/system/cpu/vulnerabilities/spectre_v2"; then if grep -q 'Indirect Branch Restricted Speculation' "/sys/devices/system/cpu/vulnerabilities/spectre_v2"; then
_debug "ibrs: found IBRS in sysfs" _debug "ibrs: found IBRS in sysfs"
ibrs_supported='found IBRS in sysfs' [ -z "$ibrs_supported" ] && ibrs_supported='found IBRS in sysfs'
ibrs_enabled=3 [ -z "$ibrs_enabled" ] && ibrs_enabled=3
fi fi
fi fi
# in live mode, if ibrs or ibpb is supported and we didn't find these are enabled, then they are not # in live mode, if ibrs or ibpb is supported and we didn't find these are enabled, then they are not
@ -2017,8 +2017,8 @@ check_variant2_linux()
fi fi
fi fi
;; ;;
1) pstatus green YES "for kernel space";; 1) if [ "$ibrs_fw_enabled" = 1 ]; then pstatus green YES "for kernel space and firmware code"; else pstatus green YES "for kernel space"; fi;;
2) pstatus green YES "for both kernel and user space";; 2) if [ "$ibrs_fw_enabled" = 1 ]; then pstatus green YES "for kernel, user space, and firmware code" ; else pstatus green YES "for both kernel and user space"; fi;;
3) if [ "$ibrs_fw_enabled" = 1 ]; then pstatus green YES "for kernel and firmware code"; else pstatus green YES; fi;; 3) if [ "$ibrs_fw_enabled" = 1 ]; then pstatus green YES "for kernel and firmware code"; else pstatus green YES; fi;;
*) pstatus yellow UNKNOWN;; *) pstatus yellow UNKNOWN;;
esac esac