mirror of
https://github.com/speed47/spectre-meltdown-checker
synced 2024-11-06 22:23:41 +01:00
remove hardcoded kernel image path
This commit is contained in:
parent
9ed1fcd98a
commit
30de4f6336
@ -1,7 +1,7 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Spectre & Meltdown checker
|
# Spectre & Meltdown checker
|
||||||
# Stephane Lesimple
|
# Stephane Lesimple
|
||||||
VERSION=0.02
|
VERSION=0.03
|
||||||
|
|
||||||
pstatus()
|
pstatus()
|
||||||
{
|
{
|
||||||
@ -73,13 +73,19 @@ extract_vmlinux()
|
|||||||
/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 "* Kernel compiled with LFENCE opcode inserted at the proper places: "
|
||||||
|
|
||||||
vmlinux=$(extract_vmlinux /boot/vmlinuz-4.4.110)
|
img=''
|
||||||
status=0
|
[ -e /boot/vmlinuz-$(uname -r) ] && img=/boot/vmlinuz-$(uname -r)
|
||||||
if [ -z "$vmlinux" -o ! -r "$vmlinux" ]; then
|
[ -e /boot/vmlinux-$(uname -r) ] && img=/boot/vmlinux-$(uname -r)
|
||||||
pstatus yellow UNKNOWN "couldn't extract your kernel"
|
[ -e /boot/bzImage-$(uname -r) ] && img=/boot/bzImage-$(uname -r)
|
||||||
elif ! which objdump >/dev/null 2>&1; then
|
if [ -z "$img" ]; then
|
||||||
pstatus yellow UNKNOWN "missing 'objdump' tool, please install it, usually it's in the binutils package"
|
pstatus yellow UNKNOWN "couldn't find your kernel image in /boot"
|
||||||
else
|
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
|
||||||
|
pstatus yellow UNKNOWN "missing 'objdump' tool, please install it, usually it's in the binutils package"
|
||||||
|
else
|
||||||
nb_lfence=$(objdump -D "$vmlinux" | grep -wc lfence)
|
nb_lfence=$(objdump -D "$vmlinux" | grep -wc lfence)
|
||||||
if [ "$nb_lfence" -lt 60 ]; then
|
if [ "$nb_lfence" -lt 60 ]; then
|
||||||
pstatus red NO "only $nb_lfence opcodes found, should be >= 60"
|
pstatus red NO "only $nb_lfence opcodes found, should be >= 60"
|
||||||
@ -89,6 +95,7 @@ else
|
|||||||
status=2
|
status=2
|
||||||
fi
|
fi
|
||||||
rm -f $vmlinux
|
rm -f $vmlinux
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
/bin/echo -ne "> \033[46m\033[30mSTATUS:\033[0m "
|
/bin/echo -ne "> \033[46m\033[30mSTATUS:\033[0m "
|
||||||
|
Loading…
Reference in New Issue
Block a user