From: Chen Baozi <cbz@baozis.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org, David Woodhouse <dwmw@amazon.co.uk>,
linux-kernel@vger.kernel.org, Chen Baozi <cbz@baozis.org>
Subject: [PATCH] x86/retpoline: check CONFIG_RETPOLINE option when SPECTRE_V2_CMD_AUTO
Date: Fri, 2 Feb 2018 14:47:44 +0800 [thread overview]
Message-ID: <20180202064744.29331-1-cbz@baozis.org> (raw)
Currently, if there is no spectre_v2= or nospectre_v2 specified in the boot
parameter, the kernel will automatically choose mitigation by default.
However, when selecting the auto mode, it doesn't check whether the
retpoline has been built in the kernel. Thus, if someone built a kernel
without CONFIG_RETPOLINE and booted the system without specifying any
spectre_v2 kernel parameters, the kernel would still report that it has
enabled a minimal retpoline mitigation which is not the case. This patch
adds the checking of CONFIG_RETPOLINE option under the 'auto' mode to fix
it.
Signed-off-by: Chen Baozi <cbz@baozis.org>
---
arch/x86/kernel/cpu/bugs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 390b3dc3d438..70b7d17426eb 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -193,7 +193,9 @@ static void __init spectre_v2_select_mitigation(void)
case SPECTRE_V2_CMD_FORCE:
/* FALLTRHU */
case SPECTRE_V2_CMD_AUTO:
- goto retpoline_auto;
+ if (IS_ENABLED(CONFIG_RETPOLINE))
+ goto retpoline_auto;
+ break;
case SPECTRE_V2_CMD_RETPOLINE_AMD:
if (IS_ENABLED(CONFIG_RETPOLINE))
--
2.13.5 (Apple Git-94)
next reply other threads:[~2018-02-02 6:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-02 6:47 Chen Baozi [this message]
2018-02-02 10:35 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180202064744.29331-1-cbz@baozis.org \
--to=cbz@baozis.org \
--cc=dwmw@amazon.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®