Skip to content

Commit 388d44e

Browse files
famzahspeed47
authored andcommitted
Fix Retpoline detection for Linux 6.9+ (issue #490)
1 parent bd0c7c9 commit 388d44e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

spectre-meltdown-checker.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4394,11 +4394,11 @@ check_CVE_2017_5715_linux()
43944394
# We check the RETPOLINE kernel options
43954395
retpoline=0
43964396
if [ -r "$opt_config" ]; then
4397-
if grep -q '^CONFIG_RETPOLINE=y' "$opt_config"; then
4397+
if grep -q '^CONFIG_\(MITIGATION_\)\?RETPOLINE=y' "$opt_config"; then
43984398
pstatus green YES
43994399
retpoline=1
44004400
# shellcheck disable=SC2046
4401-
_debug 'retpoline: found '$(grep '^CONFIG_RETPOLINE' "$opt_config")" in $opt_config"
4401+
_debug 'retpoline: found '$(grep '^CONFIG_\(MITIGATION_\)\?RETPOLINE' "$opt_config")" in $opt_config"
44024402
else
44034403
pstatus yellow NO
44044404
fi
@@ -4410,8 +4410,9 @@ check_CVE_2017_5715_linux()
44104410
# Now check if the compiler used to compile the kernel knows how to insert retpolines in generated asm
44114411
# For gcc, this is -mindirect-branch=thunk-extern (detected by the kernel makefiles)
44124412
# See gcc commit https://github.com/hjl-tools/gcc/commit/23b517d4a67c02d3ef80b6109218f2aadad7bd79
4413-
# In latest retpoline LKML patches, the noretpoline_setup symbol exists only if CONFIG_RETPOLINE is set
4414-
# *AND* if the compiler is retpoline-compliant, so look for that symbol
4413+
# In latest retpoline LKML patches, the noretpoline_setup symbol exists only if CONFIG_MITIGATION_RETPOLINE is set
4414+
# *AND* if the compiler is retpoline-compliant, so look for that symbol. The name of this kernel config
4415+
# option before version 6.9-rc1 is CONFIG_RETPOLINE.
44154416
#
44164417
# if there is "retpoline" in the file and NOT "minimal", then it's full retpoline
44174418
# (works for vanilla and Red Hat variants)
@@ -4637,7 +4638,7 @@ check_CVE_2017_5715_linux()
46374638
# RETPOLINE (amd & intel &hygon )
46384639
if is_amd || is_intel || is_hygon; then
46394640
if [ "$retpoline" = 0 ]; then
4640-
explain "Your kernel is not compiled with retpoline support, so you need to either upgrade your kernel (if you're using a distro) or recompile your kernel with the CONFIG_RETPOLINE option enabled. You also need to compile your kernel with a retpoline-aware compiler (re-run this script with -v to know if your version of gcc is retpoline-aware)."
4641+
explain "Your kernel is not compiled with retpoline support, so you need to either upgrade your kernel (if you're using a distro) or recompile your kernel with the CONFIG_MITIGATION_RETPOLINE option enabled (was named CONFIG_RETPOLINE before kernel 6.9-rc1). You also need to compile your kernel with a retpoline-aware compiler (re-run this script with -v to know if your version of gcc is retpoline-aware)."
46414642
elif [ "$retpoline" = 1 ] && [ "$retpoline_compiler" = 0 ]; then
46424643
explain "Your kernel is compiled with retpoline, but without a retpoline-aware compiler (re-run this script with -v to know if your version of gcc is retpoline-aware)."
46434644
elif [ "$retpoline" = 1 ] && [ "$retpoline_compiler" = 1 ] && [ "$retp_enabled" = 0 ]; then

0 commit comments

Comments
 (0)