Message ID | 20200526052848.605423-1-andi@firstfloor.org |
---|---|
State | New |
Headers | show |
Series | [v1] x86: Pin cr4 FSGSBASE | expand |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index bed0cb83fe24..1f5b7871ae9a 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -385,6 +385,11 @@ void native_write_cr4(unsigned long val) /* Warn after we've set the missing bits. */ WARN_ONCE(bits_missing, "CR4 bits went missing: %lx!?\n", bits_missing); + if (val & X86_CR4_FSGSBASE) { + WARN_ONCE(1, "CR4 unexpectedly set FSGSBASE!?\n"); + val &= ~X86_CR4_FSGSBASE; + goto set_register; + } } } EXPORT_SYMBOL(native_write_cr4);