From d2f46740e912dea41298742fe336a7934e72260f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lesimple?= Date: Sat, 10 Mar 2018 14:56:10 +0100 Subject: [PATCH] feat: enhance kernel image version detection for some old kernels --- spectre-meltdown-checker.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spectre-meltdown-checker.sh b/spectre-meltdown-checker.sh index 3a79be7..34e4e67 100755 --- a/spectre-meltdown-checker.sh +++ b/spectre-meltdown-checker.sh @@ -1004,6 +1004,10 @@ if [ -z "$vmlinux" ] || [ ! -r "$vmlinux" ]; then [ -z "$vmlinux_err" ] && vmlinux_err="couldn't extract your kernel from $opt_kernel" else vmlinux_version=$(strings "$vmlinux" 2>/dev/null | grep '^Linux version ' | head -1) + if [ -z "$vmlinux_version" ]; then + # try harder with some kernels (such as Red Hat) that don't have ^Linux version before their version string + vmlinux_version=$(strings "$vmlinux" 2>/dev/null | grep -E '^[[:alnum:]][^[:space:]]+ \([^[:space:]]+\) #[0-9]+ .+ (19|20)[0-9][0-9]$' | head -1) + fi if [ -n "$vmlinux_version" ]; then # in live mode, check if the img we found is the correct one if [ "$opt_live" = 1 ]; then @@ -1015,6 +1019,8 @@ else else _info "Kernel image is \033[35m$vmlinux_version" fi + else + _verbose "Kernel image version is unknown" fi fi