x86/cpu, x86/pti: Do not enable PTI on AMD processors
PATCH 1/1 x86/cpu, x86/pti: Do not enable PTI on AMD processors
AMD processors are not subject to the types of attacks that the kernel page table isolation feature protects against. The AMD microarchitecture does not allow memory references, including speculative references, that access higher privileged data when running in a lesser privileged mode when that access would result in a page fault.
Disable page table isolation by default on AMD processors by not setting the X86_BUG_CPU_INSECURE feature, which controls whether X86_FEATURE_PTI is set.
--- arch/x86/kernel/cpu/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/common.c +2 -2
@@ -923,8 +923,8 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)setup_force_cpu_cap (X86_FEATURE_ALWAYS ); -/* Assume for now that ALL x86 CPUs are insecure */ -setup_force_cpu_bug (X86_BUG_CPU_INSECURE ); +if (c->x86_vendor !=X86_VENDOR_AMD ) +setup_force_cpu_bug (X86_BUG_CPU_INSECURE );fpu__init_system (c);
Dave Hansen
maintainerarch/x86/kernel/cpu/common.c static void __init early_identify_cpu(struct cpuinfo_x86 *c) · line 927
Quoted 10 lines · Tom Lendacky
arch/x86/kernel/cpu/common.c +2
-2@@ -923,8 +923,8 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)setup_force_cpu_cap (X86_FEATURE_ALWAYS ); -/* Assume for now that ALL x86 CPUs are insecure */ -setup_force_cpu_bug (X86_BUG_CPU_INSECURE ); +if (c->x86_vendor !=X86_VENDOR_AMD ) +setup_force_cpu_bug (X86_BUG_CPU_INSECURE );
Does this disable it in a way that it can be turned back on via the kernel command-line?
This is a rather wide class of issues and I would rather not just hard-code it in a way that we say one vendor has never and will never be affected.
Quoted 7 lines · Dave Hansen
Quoted 6 lines · Tom Lendacky
arch/x86/kernel/cpu/common.c +0
-0@@ -923,8 +923,8 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)setup_force_cpu_cap (X86_FEATURE_ALWAYS );
Quoted 8 lines
arch/x86/kernel/cpu/common.c static void __init early_identify_cpu(struct cpuinfo_x86 *c) · line 927
Quoted 4 lines
arch/x86/kernel/cpu/common.c +2
-2-/* Assume for now that ALL x86 CPUs are insecure */ -setup_force_cpu_bug (X86_BUG_CPU_INSECURE ); +if (c->x86_vendor !=X86_VENDOR_AMD ) +setup_force_cpu_bug (X86_BUG_CPU_INSECURE );Does this disable it in a way that it can be turned back on via the kernel command-line?
Yes, specifying pti=on on the command line will turn kernel page table isolation on regardless of this setting.
Thanks,
Tom
Quoted 4 lines
This is a rather wide class of issues and I would rather not just hard-code it in a way that we say one vendor has never and will never be affected.
Quoted 20 lines · Tom Lendacky
AMD processors are not subject to the types of attacks that the kernel page table isolation feature protects against. The AMD microarchitecture does not allow memory references, including speculative references, that access higher privileged data when running in a lesser privileged mode when that access would result in a page fault.
Disable page table isolation by default on AMD processors by not setting the
X86_BUG_CPU_INSECUREfeature, which controls whetherX86_FEATURE_PTIis set.Signed-off-by Tom Lendacky <[email protected]>--- arch/x86/kernel/cpu/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/kernel/cpu/common.c +0
-0
arch/x86/kernel/cpu/common.c static void __init early_identify_cpu(struct cpuinfo_x86 *c) · line 929
Quoted 9 lines
arch/x86/kernel/cpu/common.c +2
-2@@ -923,8 +923,8 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)setup_force_cpu_cap (X86_FEATURE_ALWAYS ); -/* Assume for now that ALL x86 CPUs are insecure */ -setup_force_cpu_bug (X86_BUG_CPU_INSECURE ); +if (c->x86_vendor !=X86_VENDOR_AMD ) +setup_force_cpu_bug (X86_BUG_CPU_INSECURE );fpu__init_system (c);
Signature · 5 lines
Regards/Gruss,
Boris.
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- tip-bot for Tom Lendacky
merge botx86/cpu, x86/pti: Do not enable PTI on AMD processors
Commit-ID: 694d99d40972f12e59a3696effee8a376b79d7c8 Gitweb: https://git.kernel.org/tip/694d99d40972f12e59a3696effee8a376b79d7c8 Author: Tom Lendacky <[email protected]> AuthorDate: Tue, 26 Dec 2017 23:43:54 -0600 Committer: Thomas Gleixner <[email protected]> CommitDate: Wed, 3 Jan 2018 15:57:59 +0100
x86/cpu, x86/pti: Do not enable PTI on AMD processors
AMD processors are not subject to the types of attacks that the kernel page table isolation feature protects against. The AMD microarchitecture does not allow memory references, including speculative references, that access higher privileged data when running in a lesser privileged mode when that access would result in a page fault.
Disable page table isolation by default on AMD processors by not setting the X86_BUG_CPU_INSECURE feature, which controls whether X86_FEATURE_PTI is set.
--- arch/x86/kernel/cpu/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/common.c +2 -2
@@ -899,8 +899,8 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)setup_force_cpu_cap (X86_FEATURE_ALWAYS ); -/* Assume for now that ALL x86 CPUs are insecure */ -setup_force_cpu_bug (X86_BUG_CPU_INSECURE ); +if (c->x86_vendor !=X86_VENDOR_AMD ) +setup_force_cpu_bug (X86_BUG_CPU_INSECURE );fpu__init_system (c);
Quoted 9 lines · Tom Lendacky
AMD processors are not subject to the types of attacks that the kernel page table isolation feature protects against. The AMD microarchitecture does not allow memory references, including speculative references, that access higher privileged data when running in a lesser privileged mode when that access would result in a page fault.
Disable page table isolation by default on AMD processors by not setting the
X86_BUG_CPU_INSECUREfeature, which controls whetherX86_FEATURE_PTIis set.
PTI was originally meant to protect KASLR from memory leaks, before Spectre was public. I guess that's still valid use on AMD cpus?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 7 lines · Pavel Machek
Quoted 6 lines · Tom Lendacky
AMD processors are not subject to the types of attacks that the kernel page table isolation feature protects against. The AMD microarchitecture does not allow memory references, including speculative references, that access higher privileged data when running in a lesser privileged mode when that access would result in a page fault.
Quoted 7 lines
Quoted 3 lines
Disable page table isolation by default on AMD processors by not setting the
X86_BUG_CPU_INSECUREfeature, which controls whetherX86_FEATURE_PTIis set.PTI was originally meant to protect KASLR from memory leaks, before Spectre was public. I guess that's still valid use on AMD cpus?
Pavel
KASLR leaks are a much lower threat than Meltdown. Given that no AMD processor supports PCID, enabling PTI has a much more significant performance impact for a much smaller benefit. For the paranoid user they still have the option to enable PTI at boot, but it should not be on by default.
--
Brian Gerst
Quoted 7 lines · Pavel Machek
Quoted 6 lines · Tom Lendacky
AMD processors are not subject to the types of attacks that the kernel page table isolation feature protects against. The AMD microarchitecture does not allow memory references, including speculative references, that access higher privileged data when running in a lesser privileged mode when that access would result in a page fault.
Quoted 6 lines
Quoted 3 lines
Disable page table isolation by default on AMD processors by not setting the
X86_BUG_CPU_INSECUREfeature, which controls whetherX86_FEATURE_PTIis set.PTI was originally meant to protect KASLR from memory leaks, before Spectre was public. I guess that's still valid use on AMD cpus?
The KASLR attacks against which PTI protects are not based on a memory leak. The KASLR attacks are revealing the kernel virtual address space w/o revealing any data.
Quite some of those attacks can be mitigated via PTI, but only some of the attacks work on AMD CPUs. The bulk (and easy to conduct) attacks do not work work on AMD CPUs due to the same reason why Meltdown does not work.
Thanks,
tglx