diff options
author | Stéphane Lesimple <speed47_github@speed47.net> | 2018-01-07 16:57:14 +0100 |
---|---|---|
committer | Stéphane Lesimple <speed47_github@speed47.net> | 2018-01-07 16:57:14 +0100 |
commit | bd4c74331ef42a7299951a030f2ab0159384b6a4 (patch) | |
tree | 79577746413c8575891dc3c6e36c4a225a4606a9 | |
parent | 82972f8790cfa9d61399d811403bb2f2bea4bf6a (diff) | |
download | spectre-meltdown-checker-bd4c74331ef42a7299951a030f2ab0159384b6a4.tar.lz spectre-meltdown-checker-bd4c74331ef42a7299951a030f2ab0159384b6a4.tar.xz spectre-meltdown-checker-bd4c74331ef42a7299951a030f2ab0159384b6a4.zip |
add retpolines check
-rwxr-xr-x | spectre-meltdown-checker.sh | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/spectre-meltdown-checker.sh b/spectre-meltdown-checker.sh index accdf0d..126c094 100755 --- a/spectre-meltdown-checker.sh +++ b/spectre-meltdown-checker.sh @@ -1,7 +1,7 @@ #! /bin/sh # Spectre & Meltdown checker # Stephane Lesimple -VERSION=0.03 +VERSION=0.04 pstatus() { @@ -164,15 +164,32 @@ fi /bin/echo "* Mitigation 2" /bin/echo -n "* Kernel recompiled with retpolines: " -pstatus yellow UNKNOWN "check not yet implemented" +# XXX this doesn't mean the kernel has been compiled with a retpoline-aware gcc +if [ -e /proc/config.gz ]; then + if zgrep -q '^CONFIG_RETPOLINE=y' /proc/config.gz; then + pstatus green YES + retpoline=1 + else + pstatus red NO + fi +elif [ -e /boot/config-$(uname -r) ]; then + if grep -q '^CONFIG_RETPOLINE=y' /boot/config-$(uname -r); then + pstatus green YES + retpoline=1 + else + pstatus red NO + fi +fi /bin/echo -ne "> \033[46m\033[30mSTATUS:\033[0m " if grep -q AMD /proc/cpuinfo; then pstatus green "NOT VULNERABLE" "your CPU is not vulnerable as per the vendor" elif [ "$ibrs_enabled" = 1 -o "$ibrs_enabled" = 2 ]; then pstatus green "NOT VULNERABLE" "IBRS mitigates the vulnerability" +elif [ "$retpoline" = 1 ]; then + pstatus green "NOT VULNERABLE" "retpolines mitigate the vulnerability" else - pstatus red VULNERABLE "IBRS hardware + kernel support OR retpolines-compiled kernel are needed to mitigate the vulnerability" + pstatus red VULNERABLE "IBRS hardware + kernel support OR kernel with retpolines kernel are needed to mitigate the vulnerability" fi # MELTDOWN |