i386: Make CMPXCHG64 only dependent on PAE
PATCH 1/3 i386: Make CMPXCHG64 only dependent on PAE
It is only used for PAE kernels in set_64bit.
The problem is that due to a old Windows bug many CPUs need magic MSRs to enable CMPXCHG64, and we can't do that nicely early enough before it is potentially used.
But since we only need it in PAE kernels so only force the checking for CMPXCHG65 with PAE.
This fixes a boot failure on Transmeta Crusoe
--- arch/i386/Kconfig.cpu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/i386/Kconfig.cpu +1 -1
@@ -299,7 +299,7 @@ config X86_POPAD_OK config X86_CMPXCHG64 bool - depends on !M386 && !M486 + depends on X86_PAE default y config X86_ALIGNMENT_16
arch/i386/Kconfig +1 -1
@@ -541,7 +541,7 @@ config HIGHMEM4G config HIGHMEM64G bool "64GB" - depends on X86_CMPXCHG64 + depends on !M386 && !M486 help Select this if you have a 32-bit processor and more than 4 gigabytes of physical RAM.
PATCH 2/3 x86_64: Fix only make Macintosh drivers default on Macs
From: Olaf Hering <[email protected]>
Include PPC_MAC in the default too, not only MAC which only covers m68k MACs.
--- drivers/macintosh/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/Kconfig +1 -1
@@ -2,7 +2,7 @@ menuconfig MACINTOSH_DRIVERS bool "Macintosh device drivers" depends on PPC || MAC || X86 - default y if MAC + default y if (PPC_PMAC || MAC) if MACINTOSH_DRIVERS
PATCH 3/3 x86_64: Ignore compat mode SYSCALL when IA32_EMULATION is not defined
In reply to Andi KleenPreviously a program could switch to a compat mode segment and then execute SYSCALL and it would jump to an uninitialized MSR and crash the kernel.
Instead supply a dummy target for this case.
Pointed out by Jan Beulich
--- arch/x86_64/kernel/entry.S | 7 +++++++ arch/x86_64/kernel/setup64.c | 3 +++ 2 files changed, 10 insertions(+)
arch/x86_64/kernel/entry.S +7 -0
@@ -1163,3 +1163,10 @@ ENTRY(call_softirq) ret CFI_ENDPROC ENDPROC(call_softirq) + +KPROBE_ENTRY(ignore_sysret) + CFI_STARTPROC + mov $-ENOSYS,%eax + sysret + CFI_ENDPROC +ENDPROC(ignore_sysret)
arch/x86_64/kernel/setup64.c +3 -0
@@ -150,6 +150,8 @@ void pda_init(int cpu) char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ] __attribute__((section(".bss.page_aligned"))); +extern asmlinkage void ignore_sysret(void); +/* May not be marked __init: used by software suspend */ void syscall_init (void ) {
@@ -160,6 +162,7 @@ void syscall_init(void)*/ wrmsrl (MSR_STAR , ((u64 )__USER32_CS)<<48 | ((u64 )__KERNEL_CS)<<32 );wrmsrl (MSR_LSTAR , system_call); +wrmsrl (MSR_CSTAR , ignore_sysret);#ifdef CONFIG_IA32_EMULATION syscall32_cpu_init ();