Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1373930
| From | Andy Lutomirski <luto@amacapital.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3 6/7] x86/cpu: Add Erratum 88 detection on AMD |
| Date | 2016-04-08 03:50 +0200 |
| Message-ID | <rltIC-4zb-3@gated-at.bofh.it> (permalink) |
| References | <rlsCT-3LP-15@gated-at.bofh.it> <rltIC-4zb-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Apr 7, 2016 at 5:31 PM, Andy Lutomirski <luto@kernel.org> wrote: > From: Borislav Petkov <bp@suse.de> > > Erratum 88 affects old AMD K8s, where a SWAPGS fails to cause an input > dependency on GS. Therefore, we need to MFENCE before it. > > But that MFENCE is expensive and unnecessary on the remaining x86 CPUs > out there so patch it out on the CPUs which don't require it. This is basically identical to: https://lkml.kernel.org/g/1458576969-13309-4-git-send-email-andi@firstfloor.org Whoops! I thought I'd seen that somewhere but I couldn't spot it. Ingo, etc: we should probably apply one of those patches with a -stable tag (to mitigate the otherwise potentially unpleasant performance regression in here), but I don't really care which one. Andi's has a name for the bug that seems nicer by one character to me, but it would have to be (trivally) rebased. --Andy > > Signed-off-by: Borislav Petkov <bp@suse.de> > Cc: <stable@vger.kernel.org> > Signed-off-by: Andy Lutomirski <luto@kernel.org > --- > arch/x86/entry/entry_64.S | 2 +- > arch/x86/include/asm/cpufeatures.h | 2 ++ > arch/x86/kernel/cpu/amd.c | 1 + > 3 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S > index 858b555e274b..64d2033d1e49 100644 > --- a/arch/x86/entry/entry_64.S > +++ b/arch/x86/entry/entry_64.S > @@ -783,7 +783,7 @@ ENTRY(native_load_gs_index) > SWAPGS > gs_change: > movl %edi, %gs > -2: mfence /* workaround */ > +2: ALTERNATIVE "", "mfence", X86_BUG_SWAPGS_FENCE > SWAPGS > popfq > ret > diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h > index 2a052302bc43..7bfb6b70c745 100644 > --- a/arch/x86/include/asm/cpufeatures.h > +++ b/arch/x86/include/asm/cpufeatures.h > @@ -295,6 +295,8 @@ > #define X86_BUG_CLFLUSH_MONITOR X86_BUG(7) /* AAI65, CLFLUSH required before MONITOR */ > #define X86_BUG_SYSRET_SS_ATTRS X86_BUG(8) /* SYSRET doesn't fix up SS attrs */ > #define X86_BUG_NULL_SEG X86_BUG(9) /* Nulling a selector preserves the base */ > +#define X86_BUG_SWAPGS_FENCE X86_BUG(10) /* SWAPGS without input dep on GS */ > + > > #ifdef CONFIG_X86_32 > /* > diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c > index 6e47e3a916f1..b7cc9efe08b5 100644 > --- a/arch/x86/kernel/cpu/amd.c > +++ b/arch/x86/kernel/cpu/amd.c > @@ -632,6 +632,7 @@ static void init_amd_k8(struct cpuinfo_x86 *c) > */ > msr_set_bit(MSR_K7_HWCR, 6); > #endif > + set_cpu_bug(c, X86_BUG_SWAPGS_FENCE); > } > > static void init_amd_gh(struct cpuinfo_x86 *c) > -- > 2.5.5 > -- Andy Lutomirski AMA Capital Management, LLC
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 0/7] x86: Pile o' FS/GS changes Andy Lutomirski <luto@kernel.org> - 2016-04-08 02:40 +0200
[PATCH v3 1/7] selftests/x86: Test the FSBASE/GSBASE API and context switching Andy Lutomirski <luto@kernel.org> - 2016-04-08 02:40 +0200
[tip:x86/asm] selftests/x86: Test the FSBASE/GSBASE API and context switching tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-13 13:40 +0200
[PATCH v3 5/7] x86/cpu: Move X86_BUG_ESPFIX initialization to generic_identify Andy Lutomirski <luto@kernel.org> - 2016-04-08 02:40 +0200
[tip:x86/asm] x86/cpu: Move X86_BUG_ESPFIX initialization to generic_identify() tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-13 13:40 +0200
[PATCH v3 7/7] x86/entry: Make gs_change a local label Andy Lutomirski <luto@kernel.org> - 2016-04-08 02:40 +0200
[tip:x86/asm] x86/entry/64: Make gs_change a local label tip-bot for Borislav Petkov <tipbot@zytor.com> - 2016-04-13 13:40 +0200
Re: [PATCH v3 6/7] x86/cpu: Add Erratum 88 detection on AMD Andy Lutomirski <luto@amacapital.net> - 2016-04-08 03:50 +0200
Re: [PATCH v3 6/7] x86/cpu: Add Erratum 88 detection on AMD Borislav Petkov <bp@alien8.de> - 2016-04-08 12:00 +0200
Re: [PATCH v3 2/7] x86/arch_prctl: Fix ARCH_GET_FS and ARCH_GET_GS Ingo Molnar <mingo@kernel.org> - 2016-04-08 09:20 +0200
Re: [PATCH v3 2/7] x86/arch_prctl: Fix ARCH_GET_FS and ARCH_GET_GS Dmitry Safonov <0x7f454c46@gmail.com> - 2016-04-08 11:40 +0200
Re: [PATCH v3 2/7] x86/arch_prctl: Fix ARCH_GET_FS and ARCH_GET_GS Andy Lutomirski <luto@amacapital.net> - 2016-04-08 18:10 +0200
Re: [PATCH v3 0/7] x86: Pile o' FS/GS changes Borislav Petkov <bp@alien8.de> - 2016-04-08 12:40 +0200
Re: [PATCH v3 0/7] x86: Pile o' FS/GS changes Borislav Petkov <bp@alien8.de> - 2016-04-08 12:50 +0200
csiph-web