All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Andi Kleen <andi@firstfloor.org>, tglx@linutronix.de
Cc: gregkh@linuxfoundation.org, dwmw@amazon.co.uk,
	linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
	x86@kernel.org, arjan@linux.intel.com,
	Andi Kleen <ak@linux.intel.com>,
	jeyu@kernel.org
Subject: Re: [PATCH v4] retpoline/module: Warn for missing retpoline in module
Date: Thu, 25 Jan 2018 15:53:36 -0800	[thread overview]
Message-ID: <e3429aa0-ccbc-e814-f67f-cd5b1f23bcbf@infradead.org> (raw)
In-Reply-To: <20180125235028.31211-1-andi@firstfloor.org>

On 01/25/2018 03:50 PM, Andi Kleen wrote:

> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index 390b3dc3d438..8766e13efe80 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -11,6 +11,7 @@
>  #include <linux/init.h>
>  #include <linux/utsname.h>
>  #include <linux/cpu.h>
> +#include <linux/module.h>
>  
>  #include <asm/nospec-branch.h>
>  #include <asm/cmdline.h>
> @@ -94,6 +95,20 @@ static const char *spectre_v2_strings[] = {
>  
>  static enum spectre_v2_mitigation spectre_v2_enabled = SPECTRE_V2_NONE;
>  
> +static bool spectre_v2_bad_module;
> +
> +#ifdef RETPOLINE
> +bool retpoline_module_ok(bool has_retpoline)
> +{
> +	if (spectre_v2_enabled == SPECTRE_V2_NONE || has_retpoline)
> +		return true;
> +
> +	pr_err("system may be vunerable to spectre_v2\n");

	                      vulnerable

> +	spectre_v2_bad_module = true;
> +	return false;
> +}
> +#endif
> +
>  static void __init spec2_print_if_insecure(const char *reason)
>  {
>  	if (boot_cpu_has_bug(X86_BUG_SPECTRE_V2))
> @@ -278,6 +293,7 @@ ssize_t cpu_show_spectre_v2(struct device *dev,
>  	if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V2))
>  		return sprintf(buf, "Not affected\n");
>  
> -	return sprintf(buf, "%s\n", spectre_v2_strings[spectre_v2_enabled]);
> +	return sprintf(buf, "%s%s\n", spectre_v2_strings[spectre_v2_enabled],
> +			spectre_v2_bad_module ? " but vulnerable module loaded" : "");
>  }
>  #endif


-- 
~Randy

  reply	other threads:[~2018-01-25 23:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-25 23:50 Andi Kleen
2018-01-25 23:53 ` Randy Dunlap [this message]
2018-01-26 14:59 ` [tip:x86/pti] module/retpoline: Warn about " tip-bot for Andi Kleen
2018-01-26 17:51   ` Randy Dunlap
2018-01-27 13:40   ` Borislav Petkov

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=e3429aa0-ccbc-e814-f67f-cd5b1f23bcbf@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=arjan@linux.intel.com \
    --cc=dwmw@amazon.co.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeyu@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    --subject='Re: [PATCH v4] retpoline/module: Warn for missing retpoline in module' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.