aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStéphane Lesimple <speed47_github@speed47.net>2018-01-26 14:55:01 +0100
committerStéphane Lesimple <speed47_github@speed47.net>2018-01-26 14:55:01 +0100
commit0798bd4c5b8bb712a4f625a13de54b9c2e28a607 (patch)
treebfe8096719fe1744e61e4b573cc8ee85cbcd87a0
parent42094c4f8b55fc56d341463bdf2be9aecb9927e1 (diff)
downloadspectre-meltdown-checker-0798bd4c5b8bb712a4f625a13de54b9c2e28a607.tar.lz
spectre-meltdown-checker-0798bd4c5b8bb712a4f625a13de54b9c2e28a607.tar.xz
spectre-meltdown-checker-0798bd4c5b8bb712a4f625a13de54b9c2e28a607.zip
fix: report arch_capabilities as NO when no MSR
When the arch_capabilities MSR is not there, it means that all the features it might advertise can be considered as NO instead of UNKNOWN
-rwxr-xr-xspectre-meltdown-checker.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/spectre-meltdown-checker.sh b/spectre-meltdown-checker.sh
index 7b3e7dc..a19d4c3 100755
--- a/spectre-meltdown-checker.sh
+++ b/spectre-meltdown-checker.sh
@@ -1059,6 +1059,8 @@ check_cpu()
if [ "$cpuid_arch_capabilities" = -1 ]; then
pstatus yellow UNKNOWN
elif [ "$cpuid_arch_capabilities" != 1 ]; then
+ capabilities_rdcl_no=0
+ capabilities_ibrs_all=0
pstatus red NO
elif [ ! -e /dev/cpu/0/msr ]; then
spec_ctrl_msr=-1
@@ -1068,10 +1070,10 @@ check_cpu()
# here we use dd, it's the same as using 'rdmsr 0x10a' but without needing the rdmsr tool
# if we get a read error, the MSR is not there. bs has to be 8 for msr
capabilities=$(dd if=/dev/cpu/0/msr bs=8 count=1 skip=266 iflag=skip_bytes 2>/dev/null | od -t u1 -A n | awk '{print $8}')
+ capabilities_rdcl_no=0
+ capabilities_ibrs_all=0
if [ $? -eq 0 ]; then
_debug "capabilities MSR lower byte is $capabilities (decimal)"
- capabilities_rdcl_no=0
- capabilities_ibrs_all=0
[ $(( capabilities & 1 )) -eq 1 ] && capabilities_rdcl_no=1
[ $(( capabilities & 2 )) -eq 2 ] && capabilities_ibrs_all=1
_debug "capabilities says rdcl_no=$capabilities_rdcl_no ibrs_all=$capabilities_ibrs_all"