remove hardcoded kernel image path

This commit is contained in:
Stéphane Lesimple 2018-01-07 16:25:50 +01:00
parent 9ed1fcd98a
commit 30de4f6336
1 changed files with 21 additions and 14 deletions

View File

@ -1,7 +1,7 @@
#! /bin/sh
# Spectre & Meltdown checker
# Stephane Lesimple
VERSION=0.02
VERSION=0.03
pstatus()
{
@ -73,8 +73,14 @@ extract_vmlinux()
/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: "
vmlinux=$(extract_vmlinux /boot/vmlinuz-4.4.110)
status=0
img=''
[ -e /boot/vmlinuz-$(uname -r) ] && img=/boot/vmlinuz-$(uname -r)
[ -e /boot/vmlinux-$(uname -r) ] && img=/boot/vmlinux-$(uname -r)
[ -e /boot/bzImage-$(uname -r) ] && img=/boot/bzImage-$(uname -r)
if [ -z "$img" ]; then
pstatus yellow UNKNOWN "couldn't find your kernel image in /boot"
else
vmlinux=$(extract_vmlinux $img)
if [ -z "$vmlinux" -o ! -r "$vmlinux" ]; then
pstatus yellow UNKNOWN "couldn't extract your kernel"
elif ! which objdump >/dev/null 2>&1; then
@ -90,6 +96,7 @@ else
fi
rm -f $vmlinux
fi
fi
/bin/echo -ne "> \033[46m\033[30mSTATUS:\033[0m "
[ "$status" = 0 ] && pstatus yellow UNKNOWN