1
0
mirror of https://github.com/speed47/spectre-meltdown-checker synced 2024-11-19 04:22:22 +01:00

fix for uncompressed vmlinux case

This commit is contained in:
Stéphane Lesimple 2018-01-08 00:45:12 +01:00
parent 05c79425ab
commit 96dfa03c00

View File

@ -1,7 +1,7 @@
#! /bin/sh #! /bin/sh
# Spectre & Meltdown checker # Spectre & Meltdown checker
# Stephane Lesimple # Stephane Lesimple
VERSION=0.08 VERSION=0.09
pstatus() pstatus()
{ {
@ -43,7 +43,7 @@ try_decompress()
do do
pos=${pos%%:*} pos=${pos%%:*}
tail -c+$pos "$img" | $3 > $vmlinuxtmp 2> /dev/null tail -c+$pos "$img" | $3 > $vmlinuxtmp 2> /dev/null
check_vmlinux $vmlinuxtmp && echo $vmlinuxtmp || rm -f $vmlinuxtmp check_vmlinux $vmlinuxtmp && echo $vmlinuxtmp && return 0
done done
} }
@ -55,7 +55,11 @@ extract_vmlinux()
vmlinuxtmp=$(mktemp /tmp/vmlinux-XXX) vmlinuxtmp=$(mktemp /tmp/vmlinux-XXX)
# Initial attempt for uncompressed images or objects: # Initial attempt for uncompressed images or objects:
check_vmlinux $img if check_vmlinux $img; then
cat $img > $vmlinuxtmp
echo $vmlinuxtmp
return 0
fi
# That didn't work, so retry after decompression. # That didn't work, so retry after decompression.
try_decompress '\037\213\010' xy gunzip || \ try_decompress '\037\213\010' xy gunzip || \
@ -77,6 +81,7 @@ status=0
img='' img=''
[ -e /boot/vmlinuz-$(uname -r) ] && img=/boot/vmlinuz-$(uname -r) [ -e /boot/vmlinuz-$(uname -r) ] && img=/boot/vmlinuz-$(uname -r)
[ -e /boot/vmlinux-$(uname -r) ] && img=/boot/vmlinux-$(uname -r) [ -e /boot/vmlinux-$(uname -r) ] && img=/boot/vmlinux-$(uname -r)
[ -e /boot/kernel-$( uname -r) ] && img=/boot/kernel-$( uname -r)
[ -e /boot/bzImage-$(uname -r) ] && img=/boot/bzImage-$(uname -r) [ -e /boot/bzImage-$(uname -r) ] && img=/boot/bzImage-$(uname -r)
if [ -z "$img" ]; then if [ -z "$img" ]; then
pstatus yellow UNKNOWN "couldn't find your kernel image in /boot" pstatus yellow UNKNOWN "couldn't find your kernel image in /boot"
@ -256,5 +261,5 @@ if [ "$USER" != root ]; then
/bin/echo "You can try the following command: sudo $0" /bin/echo "You can try the following command: sudo $0"
fi fi
[ -n "$vmlinux" ] && rm -f "$vmlinux" [ -n "$vmlinux" -a -f "$vmlinux" ] && rm -f "$vmlinux"