Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 14 Oct 2014 00:28:16 +0000 (02:28 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 14 Oct 2014 00:28:16 +0000 (02:28 +0200)
Pull x86 fixes from Ingo Molnar:
 "Misc smaller fixes that missed the v3.17 cycle"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/build: Add arch/x86/purgatory/ make generated files to gitignore
  x86: Fix section conflict for numachip
  x86: Reject x32 executables if x32 ABI not supported
  x86_64, entry: Filter RFLAGS.NT on entry from userspace
  x86, boot, kaslr: Fix nuisance warning on 32-bit builds

arch/x86/.gitignore
arch/x86/boot/compressed/aslr.c
arch/x86/ia32/ia32entry.S
arch/x86/include/asm/elf.h
arch/x86/kernel/apic/apic_numachip.c
arch/x86/kernel/cpu/common.c

index 7cab8c08e6d1d2eee802397c9bc17ea0f7b1bbc1..aff152c87cf4ba62ed26ed6b7eb567b576dd84fd 100644 (file)
@@ -1,4 +1,6 @@
 boot/compressed/vmlinux
 tools/test_get_len
 tools/insn_sanity
+purgatory/kexec-purgatory.c
+purgatory/purgatory.ro
 
index 7c68808edeb7070be08d195fafd35b502fef027f..bb1376381985edb9f96e49c0a1b0269e56bd0f9e 100644 (file)
@@ -194,7 +194,7 @@ static bool mem_avoid_overlap(struct mem_vector *img)
        while (ptr) {
                struct mem_vector avoid;
 
-               avoid.start = (u64)ptr;
+               avoid.start = (unsigned long)ptr;
                avoid.size = sizeof(*ptr) + ptr->len;
 
                if (mem_overlaps(img, &avoid))
index 4299eb05023cf812ee0f897a1a6189660167dc4e..711de084ab57114dc8410ea3de0fdbe436e0cf93 100644 (file)
@@ -151,6 +151,16 @@ ENTRY(ia32_sysenter_target)
 1:     movl    (%rbp),%ebp
        _ASM_EXTABLE(1b,ia32_badarg)
        ASM_CLAC
+
+       /*
+        * Sysenter doesn't filter flags, so we need to clear NT
+        * ourselves.  To save a few cycles, we can check whether
+        * NT was set instead of doing an unconditional popfq.
+        */
+       testl $X86_EFLAGS_NT,EFLAGS(%rsp)       /* saved EFLAGS match cpu */
+       jnz sysenter_fix_flags
+sysenter_flags_fixed:
+
        orl     $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET)
        testl   $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
        CFI_REMEMBER_STATE
@@ -184,6 +194,8 @@ sysexit_from_sys_call:
        TRACE_IRQS_ON
        ENABLE_INTERRUPTS_SYSEXIT32
 
+       CFI_RESTORE_STATE
+
 #ifdef CONFIG_AUDITSYSCALL
        .macro auditsys_entry_common
        movl %esi,%r9d                  /* 6th arg: 4th syscall arg */
@@ -226,7 +238,6 @@ sysexit_from_sys_call:
        .endm
 
 sysenter_auditsys:
-       CFI_RESTORE_STATE
        auditsys_entry_common
        movl %ebp,%r9d                  /* reload 6th syscall arg */
        jmp sysenter_dispatch
@@ -235,6 +246,11 @@ sysexit_audit:
        auditsys_exit sysexit_from_sys_call
 #endif
 
+sysenter_fix_flags:
+       pushq_cfi $(X86_EFLAGS_IF|X86_EFLAGS_FIXED)
+       popfq_cfi
+       jmp sysenter_flags_fixed
+
 sysenter_tracesys:
 #ifdef CONFIG_AUDITSYSCALL
        testl   $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
index 1a055c81d864d0027499f56d03cf210571e3bacf..ca3347a9dab5211399e9e93a5e53d71ca1943095 100644 (file)
@@ -160,8 +160,9 @@ do {                                                \
 #define elf_check_arch(x)                      \
        ((x)->e_machine == EM_X86_64)
 
-#define compat_elf_check_arch(x)               \
-       (elf_check_arch_ia32(x) || (x)->e_machine == EM_X86_64)
+#define compat_elf_check_arch(x)                                       \
+       (elf_check_arch_ia32(x) ||                                      \
+        (IS_ENABLED(CONFIG_X86_X32_ABI) && (x)->e_machine == EM_X86_64))
 
 #if __USER32_DS != __USER_DS
 # error "The following code assumes __USER32_DS == __USER_DS"
index ae915391ebecdbe9d01abb63e5ab787f3c484381..4128b5fcb559ff5a1041ffafe79c99413ab21d7c 100644 (file)
@@ -32,7 +32,7 @@
 
 static int numachip_system __read_mostly;
 
-static const struct apic apic_numachip __read_mostly;
+static const struct apic apic_numachip;
 
 static unsigned int get_apic_id(unsigned long x)
 {
index ef58886ba61c860bc6c08d0fbd16d327b4c70ff4..700f958652f8ac1edc9e642b44f6cb61452c48cb 100644 (file)
@@ -1184,7 +1184,7 @@ void syscall_init(void)
        /* Flags to clear on syscall */
        wrmsrl(MSR_SYSCALL_MASK,
               X86_EFLAGS_TF|X86_EFLAGS_DF|X86_EFLAGS_IF|
-              X86_EFLAGS_IOPL|X86_EFLAGS_AC);
+              X86_EFLAGS_IOPL|X86_EFLAGS_AC|X86_EFLAGS_NT);
 }
 
 /*