10 Commits
v0.17 ... v0.18

Author SHA1 Message Date
6f1bdba1d9 bump to v0.18 to reflect changes 2018-01-09 09:21:42 +01:00
7b05105a54 Merge pull request #25 from Feandil/proc_config
When using /proc/config.gz, indicate it more clearly
2018-01-09 09:19:36 +01:00
8aed2d4086 Merge pull request #26 from Feandil/proc_kallsym
Use /proc/kallsyms to get symbols, if available
2018-01-09 09:17:18 +01:00
f4140a992a Use /proc/kallsyms to get symbols, if available 2018-01-09 08:58:09 +01:00
2c51b00a90 When using /proc/config.gz, indicate it more clearly 2018-01-09 08:54:07 +01:00
2d94514c07 adding mention of heuristic for variant 1 check 2018-01-09 08:43:52 +01:00
0e8f97afbc Merge pull request #24 from angus-p/Remove-extra-space
remove superfluous space from test line 315
2018-01-09 08:34:10 +01:00
70323a30da Merge pull request #23 from mradcliffe/issue-22
Increases tmp directory uniqueness to 6 characters to support Slackware
2018-01-09 08:33:32 +01:00
cc0b325383 remove superfluous space from test line 315
Extra space was causing non-existent variable to be tested resulting in 'YES' if running in live mode and IBRS compiled in
2018-01-09 03:47:25 +00:00
4454f03136 Increases tmp directory uniqueness to 6 characters to support Slackware 2018-01-08 22:28:55 -05:00

View File

@ -1,7 +1,14 @@
#! /bin/sh #! /bin/sh
# Spectre & Meltdown checker # Spectre & Meltdown checker
#
# Check for the latest version at:
# https://github.com/speed47/spectre-meltdown-checker
# git clone https://github.com/speed47/spectre-meltdown-checker.git
# or wget https://raw.githubusercontent.com/speed47/spectre-meltdown-checker/master/spectre-meltdown-checker.sh
#
# Stephane Lesimple # Stephane Lesimple
VERSION=0.17 #
VERSION=0.18
# print status function # print status function
pstatus() pstatus()
@ -65,7 +72,7 @@ extract_vmlinux()
{ {
[ -n "$1" ] || return 1 [ -n "$1" ] || return 1
# Prepare temp files: # Prepare temp files:
vmlinuxtmp="$(mktemp /tmp/vmlinux-XXX)" vmlinuxtmp="$(mktemp /tmp/vmlinux-XXXXXX)"
trap "rm -f $vmlinuxtmp" EXIT trap "rm -f $vmlinuxtmp" EXIT
# Initial attempt for uncompressed images or objects: # Initial attempt for uncompressed images or objects:
@ -186,11 +193,15 @@ if [ "$opt_live" = 1 ]; then
[ -e /boot/kernel-genkernel-$(uname -m)-$(uname -r) ] && opt_kernel=/boot/kernel-genkernel-$(uname -m)-$(uname -r) [ -e /boot/kernel-genkernel-$(uname -m)-$(uname -r) ] && opt_kernel=/boot/kernel-genkernel-$(uname -m)-$(uname -r)
# system.map # system.map
[ -e /boot/System.map-$(uname -r) ] && opt_map=/boot/System.map-$(uname -r) if [ -e /proc/kallsyms ] ; then
opt_map="/proc/kallsyms"
elif [ -e /boot/System.map-$(uname -r) ] ; then
opt_map=/boot/System.map-$(uname -r)
fi
# config # config
if [ -e /proc/config.gz ] ; then if [ -e /proc/config.gz ] ; then
dumped_config="$(mktemp /tmp/config-XXX)" dumped_config="$(mktemp /tmp/config-XXXXXX)"
gunzip -c /proc/config.gz > $dumped_config gunzip -c /proc/config.gz > $dumped_config
# dumped_config will be deleted at the end of the script # dumped_config will be deleted at the end of the script
opt_config=$dumped_config opt_config=$dumped_config
@ -203,9 +214,11 @@ fi
if [ -n "$opt_kernel" ]; then if [ -n "$opt_kernel" ]; then
/bin/echo -e "Will use vmlinux image \033[35m$opt_kernel\033[0m" /bin/echo -e "Will use vmlinux image \033[35m$opt_kernel\033[0m"
else else
/bin/echo "Will use no vmlinux image (accuracy might be reduced" /bin/echo "Will use no vmlinux image (accuracy might be reduced)"
fi fi
if [ -n "$opt_config" ]; then if [ -n "$dumped_config" ]; then
/bin/echo -e "Will use kconfig \033[35m/proc/config.gz\033[0m"
elif [ -n "$opt_config" ]; then
/bin/echo -e "Will use kconfig \033[35m$opt_config\033[0m" /bin/echo -e "Will use kconfig \033[35m$opt_config\033[0m"
else else
/bin/echo "Will use no kconfig (accuracy might be reduced)" /bin/echo "Will use no kconfig (accuracy might be reduced)"
@ -234,7 +247,7 @@ fi
########### ###########
# SPECTRE 1 # SPECTRE 1
/bin/echo -e "\033[1;34mCVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'\033[0m" /bin/echo -e "\033[1;34mCVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'\033[0m"
/bin/echo -n "* Kernel compiled with LFENCE opcode inserted at the proper places: " /bin/echo -n "* Checking count of LFENCE opcodes in kernel: "
status=0 status=0
if [ -n "$vmlinux_err" ]; then if [ -n "$vmlinux_err" ]; then
@ -262,8 +275,8 @@ fi
/bin/echo -ne "> \033[46m\033[30mSTATUS:\033[0m " /bin/echo -ne "> \033[46m\033[30mSTATUS:\033[0m "
[ "$status" = 0 ] && pstatus yellow UNKNOWN [ "$status" = 0 ] && pstatus yellow UNKNOWN
[ "$status" = 1 ] && pstatus red VULNERABLE [ "$status" = 1 ] && pstatus red 'VULNERABLE' 'heuristic to be improved when official patches become available'
[ "$status" = 2 ] && pstatus green 'NOT VULNERABLE' [ "$status" = 2 ] && pstatus green 'NOT VULNERABLE' 'heuristic to be improved when official patches become available'
########### ###########
# VARIANT 2 # VARIANT 2