android_kernel_google_msm/arch/x86
Borislav Petkov 3682517dcd x86/cpu: Call verify_cpu() after having entered long mode too
commit 04633df0c43d710e5f696b06539c100898678235 upstream.

When we get loaded by a 64-bit bootloader, kernel entry point is
startup_64 in head_64.S. We don't trust any and all bootloaders because
some will fiddle with CPU configuration so we go ahead and massage each
CPU into sanity again.

For example, some dell BIOSes have this XD disable feature which set
IA32_MISC_ENABLE[34] and disable NX. This might be some dumb workaround
for other OSes but Linux sure doesn't need it.

A similar thing is present in the Surface 3 firmware - see
https://bugzilla.kernel.org/show_bug.cgi?id=106051 - which sets this bit
only on the BSP:

  # rdmsr -a 0x1a0
  400850089
  850089
  850089
  850089

I know, right?!

There's not even an off switch in there.

So fix all those cases by sanitizing the 64-bit entry point too. For
that, make verify_cpu() callable in 64-bit mode also.

Requested-and-debugged-by: "H. Peter Anvin" <hpa@zytor.com>
Reported-and-tested-by: Bastien Nocera <bugzilla@hadess.net>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1446739076-21303-1-git-send-email-bp@alien8.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li <lizefan@huawei.com>
2016-10-26 23:15:27 +08:00
..
boot x86, build: Pass in additional -mno-mmx, -mno-sse options 2014-06-07 16:02:08 -07:00
configs
crypto crypto: ghash-clmulni: specify context size for ghash async algorithm 2016-04-27 18:55:17 +08:00
ia32 x86-64: Replace left over sti/cli in ia32 audit exit code 2013-02-11 08:47:18 -08:00
include/asm x86/iopl/64: Properly context-switch IOPL on Xen PV 2016-04-27 18:55:30 +08:00
kernel x86/cpu: Call verify_cpu() after having entered long mode too 2016-10-26 23:15:27 +08:00
kvm KVM: x86: trap AMD MSRs for the TSeg base and mask 2016-04-27 18:55:23 +08:00
lguest x86, mm: Patch out arch_flush_lazy_mmu_mode() when running on bare metal 2013-04-16 21:27:27 -07:00
lib x86-64: Fix the failure case in copy_user_handle_tail() 2013-03-28 12:12:26 -07:00
math-emu x86/ldt: Correct FPU emulation access to LDT 2016-03-21 09:17:51 +08:00
mm x86, mm/ASLR: Fix stack randomization on 64-bit systems 2015-04-14 17:33:58 +08:00
net x86: bpf_jit: fix compilation of large bpf programs 2015-09-18 09:20:42 +08:00
oprofile oprofile, x86: Fix wrapping bug in op_x86_get_ctrl() 2012-10-28 10:14:13 -07:00
pci x86/PCI: Use host bridge _CRS info on Foxconn K8M890-8237A 2015-10-22 09:20:03 +08:00
platform x86/efi: Fix dummy variable buffer allocation 2014-06-07 16:02:10 -07:00
power x86/ldt: Make modify_ldt synchronous 2016-03-21 09:17:50 +08:00
syscalls x86, x32: Use compat shims for io_{setup,submit} 2014-06-30 20:01:33 -07:00
tools x86, relocs: Add jiffies and jiffies_64 to the relative whitelist 2012-06-01 15:18:26 +08:00
um x86, um: actually mark system call tables readonly 2015-04-14 17:33:49 +08:00
vdso x86/vdso: Fix the build on GCC5 2015-06-19 11:40:25 +08:00
video
xen x86/iopl/64: Properly context-switch IOPL on Xen PV 2016-04-27 18:55:30 +08:00
.gitignore
Kbuild
Kconfig config: Enable NEED_DMA_MAP_STATE by default when SWIOTLB is selected 2015-06-19 11:40:34 +08:00
Kconfig.cpu
Kconfig.debug
Makefile kbuild: Fix gcc -x syntax 2012-10-13 05:38:37 +09:00
Makefile.um
Makefile_32.cpu