mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bae, Chang Seok" <chang.seok.bae@intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/entry/64: Add an LFENCE after SAVE_AND_SET_GSBASE
Date: Thu, 20 Aug 2020 18:04:50 +0000	[thread overview]
Message-ID: <6236F23E-B26A-4141-AD2E-9403CFF726D3@intel.com> (raw)
In-Reply-To: <20200820091544.26564-1-bp@alien8.de>


> On Aug 20, 2020, at 02:15, Borislav Petkov <bp@alien8.de> wrote:
> 
> From: Borislav Petkov <bp@suse.de>
> 
> The FSGSBASE macro to swap current GSBASE with the kernel GSBASE
> probably had a speculation-stopping MSR write at some point but not
> anymore.

No, the macro has not any MSR write ever before.

> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
> index 26fc9b42fadc..3931d47cdd83 100644
> --- a/arch/x86/entry/entry_64.S
> +++ b/arch/x86/entry/entry_64.S
> @@ -839,11 +839,9 @@ SYM_CODE_START_LOCAL(paranoid_entry)
> 	 * Read the current GSBASE and store it in %rbx unconditionally,
> 	 * retrieve and set the current CPUs kernel GSBASE. The stored value
> 	 * has to be restored in paranoid_exit unconditionally.
> -	 *
> -	 * The MSR write ensures that no subsequent load is based on a
> -	 * mispredicted GSBASE. No extra FENCE required.

Thomas looks to add this text when he picked v7 [1].

FWIW, we added our text from v8, after reviewed the speculation impact
on this series:
	This unconditional write of GS base ensures no subsequent load 
	based on a mispredicted GS base.

I think somehow the “MSR write” made confusion. Our conclusion was the 
same as Thomas' that no FENCE is needed here.

Thanks,
Chang

[1] https://lore.kernel.org/lkml/1557309753-24073-5-git-send-email-chang.seok.bae@intel.com/t/#m45f380a23231b87498b40b708f0401147f3b0278

> 	 */
> 	SAVE_AND_SET_GSBASE scratch_reg=%rax save_reg=%rbx
> +	FENCE_SWAPGS_KERNEL_ENTRY
> 	ret
> 
> .Lparanoid_entry_checkgs:
> -- 
> 2.21.0
> 


  reply	other threads:[~2020-08-20 18:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-20  9:15 Borislav Petkov
2020-08-20 18:04 ` Bae, Chang Seok [this message]
2020-08-21  9:07   ` [PATCH -v2] x86/entry/64: Correct the comment over SAVE_AND_SET_GSBASE Borislav Petkov
2020-08-24  8:40     ` [tip: x86/fsgsbase] " tip-bot2 for 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=6236F23E-B26A-4141-AD2E-9403CFF726D3@intel.com \
    --to=chang.seok.bae@intel.com \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --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®