diff options
author | Stéphane Lesimple <speed47_github@speed47.net> | 2018-01-23 21:48:19 +0100 |
---|---|---|
committer | Stéphane Lesimple <speed47_github@speed47.net> | 2018-01-23 21:48:19 +0100 |
commit | c8a25c5d97ff3198f600409da00c9c01a39205ea (patch) | |
tree | 71aa6294dddfa9f25540e6e1b275f92b60cc8c5c | |
parent | 40381349ab54208b3bb26dac913b54b8706184f3 (diff) | |
download | spectre-meltdown-checker-c8a25c5d97ff3198f600409da00c9c01a39205ea.tar.lz spectre-meltdown-checker-c8a25c5d97ff3198f600409da00c9c01a39205ea.tar.xz spectre-meltdown-checker-c8a25c5d97ff3198f600409da00c9c01a39205ea.zip |
feat: detect invalid kconfig files
-rwxr-xr-x | spectre-meltdown-checker.sh | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/spectre-meltdown-checker.sh b/spectre-meltdown-checker.sh index 9cc41e8..09658b4 100755 --- a/spectre-meltdown-checker.sh +++ b/spectre-meltdown-checker.sh @@ -719,14 +719,22 @@ else _verbose "Will use no vmlinux image (accuracy might be reduced)" bad_accuracy=1 fi -if [ -n "$dumped_config" ]; then - _verbose "Will use kconfig \033[35m/proc/config.gz\033[0m" + +if [ -n "$opt_config" ] && ! grep -q '^CONFIG_' "$opt_config"; then + # given file is invalid! + _warn "The kernel config file seems invalid, was expecting a plain-text file, ignoring it!" + opt_config='' +fi + +if [ -n "$dumped_config" ] && [ -n "$opt_config" ]; then + _verbose "Will use kconfig \033[35m/proc/config.gz (decompressed)\033[0m" elif [ -n "$opt_config" ]; then _verbose "Will use kconfig \033[35m$opt_config\033[0m" else _verbose "Will use no kconfig (accuracy might be reduced)" bad_accuracy=1 fi + if [ -n "$opt_map" ]; then _verbose "Will use System.map file \033[35m$opt_map\033[0m" else @@ -1256,7 +1264,7 @@ _info "A false sense of security is worse than no security at all, see --disclai umount_debugfs # cleanup the temp decompressed config -[ -n "$dumped_config" ] && rm -f "$dumped_config" +[ -n "$dumped_config" ] && [ -f "$dumped_config" ] && rm -f "$dumped_config" if [ "$opt_batch" = 1 -a "$opt_batch_format" = "nrpe" ]; then if [ ! -z "$nrpe_vuln" ]; then |