3 Commits
v0.05 ... v0.07

Author SHA1 Message Date
64eb1d005c add couple missing elses 2018-01-07 18:49:15 +01:00
bffda8b3e7 remove dependency on rdmsr 2018-01-07 18:36:56 +01:00
13f2133a97 cosmetic fix 2018-01-07 18:14:08 +01:00

View File

@ -1,7 +1,7 @@
#! /bin/sh #! /bin/sh
# Spectre & Meltdown checker # Spectre & Meltdown checker
# Stephane Lesimple # Stephane Lesimple
VERSION=0.05 VERSION=0.07
pstatus() pstatus()
{ {
@ -116,22 +116,12 @@ fi
if [ ! -e /dev/cpu/0/msr ]; then if [ ! -e /dev/cpu/0/msr ]; then
pstatus yellow UNKNOWN "couldn't read /dev/cpu/0/msr, is msr support enabled in your kernel?" pstatus yellow UNKNOWN "couldn't read /dev/cpu/0/msr, is msr support enabled in your kernel?"
else else
if which rdmsr >/dev/null 2>&1; then # same that rdmsr 0x48 but without needing the rdmsr tool
rdmsr 0x48 >/dev/null 2>&1 dd if=/dev/cpu/0/msr of=/dev/null bs=8 count=1 skip=9 2>/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
pstatus green YES pstatus green YES
else
pstatus red NO
fi
else else
pstatus yellow UNKNOWN "missing 'rdmsr' tool, please install it, usually it's in the msr-tools package" pstatus red NO
# doesn't work:
#dd if=/dev/cpu/0/msr of=/dev/null bs=1 count=8 skip=72 2>/dev/null
#if [ $? -eq 0 ]; then
# pstatus green YES
#else
# pstatus red NO
#fi
fi fi
fi fi
@ -172,7 +162,7 @@ if [ "$mounted_debugfs" = 1 ]; then
fi fi
/bin/echo "* Mitigation 2" /bin/echo "* Mitigation 2"
/bin/echo -n "* Kernel recompiled with retpolines: " /bin/echo -n "* Kernel compiled with retpolines: "
# XXX this doesn't mean the kernel has been compiled with a retpoline-aware gcc # XXX this doesn't mean the kernel has been compiled with a retpoline-aware gcc
if [ -e /proc/config.gz ]; then if [ -e /proc/config.gz ]; then
if zgrep -q '^CONFIG_RETPOLINE=y' /proc/config.gz; then if zgrep -q '^CONFIG_RETPOLINE=y' /proc/config.gz; then
@ -188,6 +178,8 @@ elif [ -e /boot/config-$(uname -r) ]; then
else else
pstatus red NO pstatus red NO
fi fi
else
pstatus yellow UNKNOWN "couldn't read your kernel configuration"
fi fi
/bin/echo -ne "> \033[46m\033[30mSTATUS:\033[0m " /bin/echo -ne "> \033[46m\033[30mSTATUS:\033[0m "
@ -227,7 +219,7 @@ elif [ -e /boot/System.map-$(uname -r) ]; then
pstatus red NO pstatus red NO
fi fi
else else
pstatus yellow UNKNOWN pstatus yellow UNKNOWN "couldn't read your kernel configuration"
fi fi
/bin/echo -n "* PTI enabled and active: " /bin/echo -n "* PTI enabled and active: "