mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/retpoline: check CONFIG_RETPOLINE option when SPECTRE_V2_CMD_AUTO
@ 2018-02-02  6:47 Chen Baozi
  2018-02-02 10:35 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Baozi @ 2018-02-02  6:47 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: x86, David Woodhouse, linux-kernel, Chen Baozi

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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/retpoline: check CONFIG_RETPOLINE option when SPECTRE_V2_CMD_AUTO
  2018-02-02  6:47 [PATCH] x86/retpoline: check CONFIG_RETPOLINE option when SPECTRE_V2_CMD_AUTO Chen Baozi
@ 2018-02-02 10:35 ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2018-02-02 10:35 UTC (permalink / raw)
  To: Chen Baozi; +Cc: x86, David Woodhouse, linux-kernel

On Fri, 2 Feb 2018, Chen Baozi wrote:

> 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.

Thanks for sending that patch, but its already fixed and queued for upstream:

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=x86/pti&id=9471eee9186a46893726e22ebb54cade3f9bc043

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-02 10:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-02  6:47 [PATCH] x86/retpoline: check CONFIG_RETPOLINE option when SPECTRE_V2_CMD_AUTO Chen Baozi
2018-02-02 10:35 ` Thomas Gleixner

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®