All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@suse.de>
To: speck@linutronix.de
Subject: [MODERATED] Re: ***UNCHECKED*** [patch 3/8] [PATCH v1.3.1 3/7] Linux Patch 3
Date: Wed, 18 Apr 2018 17:37:13 +0200	[thread overview]
Message-ID: <20180418153712.GD4290@pd.tnic> (raw)
In-Reply-To: <20180418141551.07CBB6111A@crypto-ml.lab.linutronix.de>

On Thu, Apr 12, 2018 at 10:26:52PM -0400, speck for konrad.wilk_at_oracle.com wrote:
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index 561cb228605a..73f76d0f5181 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -72,6 +72,9 @@ void __init check_bugs(void)
>  	 */
>  	if (!direct_gbpages)
>  		set_memory_4k((unsigned long)__va(0), 1);
> +
> +	if (mdd_at_boot())
> +		wrmsrl(MSR_IA32_SPEC_CTRL, SPEC_CTRL_MDD);

You can't do this on the common path as that would explode on !Intel.

Instead, move that check to init_intel().

And add to init_amd_zn() code reading MSR 0xc0011020, setting bit 10 to
1b and then writing it back in the mdd_at_boot() case. We have a define
for that MSR already - MSR_AMD64_LS_CFG.

>  
> @@ -317,7 +320,14 @@ static void __init spectre_v2_select_mitigation(void)
>  #undef pr_fmt
>  #define pr_fmt(fmt)     "MDD: " fmt
>  
> -static enum md_mitigation md_mode = MD_NONE;
> +enum md_mitigation md_mode = MD_NONE;
> +/* When switching from lower privilege level (cpl3) to higher (cpl0). */
> +u64 spec_ctrl_priv;
> +EXPORT_SYMBOL_GPL(spec_ctrl_priv);
> +
> +/* When switching from higher to lower privilege level. */
> +u64 spec_ctrl_unpriv;
> +EXPORT_SYMBOL_GPL(spec_ctrl_unpriv);

I don't like exporting some arbitrary variables to the rest of the
kernel. Do accessors instead pls.

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

       reply	other threads:[~2018-04-18 15:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180418141551.07CBB6111A@crypto-ml.lab.linutronix.de>
2018-04-18 15:37 ` Borislav Petkov [this message]
2018-04-18 16:00   ` [MODERATED] Re: ***UNCHECKED*** Re: [patch 3/8] [PATCH v1.3.1 3/7] Linux Patch 3 Borislav Petkov
2018-04-18 18:07     ` [MODERATED] " Borislav Petkov
2018-04-19 20:51   ` [MODERATED] Re: ***UNCHECKED*** " Konrad Rzeszutek Wilk
2018-04-19 21:10     ` [MODERATED] " Borislav Petkov
2018-04-20  0:29       ` Konrad Rzeszutek Wilk
2018-04-20  2:39         ` Konrad Rzeszutek Wilk

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=20180418153712.GD4290@pd.tnic \
    --to=bp@suse.de \
    --cc=speck@linutronix.de \
    /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 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.