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

1  2 
arch/x86/boot/compressed/aslr.c
arch/x86/kernel/cpu/common.c

@@@ -1,5 -1,6 +1,5 @@@
  #include "misc.h"
  
 -#ifdef CONFIG_RANDOMIZE_BASE
  #include <asm/msr.h>
  #include <asm/archrandom.h>
  #include <asm/e820.h>
@@@ -194,7 -195,7 +194,7 @@@ static bool mem_avoid_overlap(struct me
        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))
@@@ -334,3 -335,5 +334,3 @@@ unsigned char *choose_kernel_location(u
  out:
        return (unsigned char *)choice;
  }
 -
 -#endif /* CONFIG_RANDOMIZE_BASE */
@@@ -346,8 -346,8 +346,8 @@@ static void filter_cpuid_features(struc
                        continue;
  
                printk(KERN_WARNING
 -                     "CPU: CPU feature %s disabled, no CPUID level 0x%x\n",
 -                              x86_cap_flags[df->feature], df->level);
 +                     "CPU: CPU feature " X86_CAP_FMT " disabled, no CPUID level 0x%x\n",
 +                              x86_cap_flag(df->feature), df->level);
        }
  }
  
@@@ -1184,7 -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);
  }
  
  /*
@@@ -1266,19 -1266,6 +1266,19 @@@ static void dbg_restore_debug_regs(void
  #define dbg_restore_debug_regs()
  #endif /* ! CONFIG_KGDB */
  
 +static void wait_for_master_cpu(int cpu)
 +{
 +#ifdef CONFIG_SMP
 +      /*
 +       * wait for ACK from master CPU before continuing
 +       * with AP initialization
 +       */
 +      WARN_ON(cpumask_test_and_set_cpu(cpu, cpu_initialized_mask));
 +      while (!cpumask_test_cpu(cpu, cpu_callout_mask))
 +              cpu_relax();
 +#endif
 +}
 +
  /*
   * cpu_init() initializes state that is per-CPU. Some data is already
   * initialized (naturally) in the bootstrap process, such as the GDT
@@@ -1294,17 -1281,16 +1294,17 @@@ void cpu_init(void
        struct task_struct *me;
        struct tss_struct *t;
        unsigned long v;
 -      int cpu;
 +      int cpu = stack_smp_processor_id();
        int i;
  
 +      wait_for_master_cpu(cpu);
 +
        /*
         * Load microcode on this cpu if a valid microcode is available.
         * This is early microcode loading procedure.
         */
        load_ucode_ap();
  
 -      cpu = stack_smp_processor_id();
        t = &per_cpu(init_tss, cpu);
        oist = &per_cpu(orig_ist, cpu);
  
  
        me = current;
  
 -      if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask))
 -              panic("CPU#%d already initialized!\n", cpu);
 -
        pr_debug("Initializing CPU#%d\n", cpu);
  
        clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
@@@ -1392,13 -1381,17 +1392,13 @@@ void cpu_init(void
        struct tss_struct *t = &per_cpu(init_tss, cpu);
        struct thread_struct *thread = &curr->thread;
  
 -      show_ucode_info_early();
 +      wait_for_master_cpu(cpu);
  
 -      if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask)) {
 -              printk(KERN_WARNING "CPU#%d already initialized!\n", cpu);
 -              for (;;)
 -                      local_irq_enable();
 -      }
 +      show_ucode_info_early();
  
        printk(KERN_INFO "Initializing CPU#%d\n", cpu);
  
 -      if (cpu_has_vme || cpu_has_tsc || cpu_has_de)
 +      if (cpu_feature_enabled(X86_FEATURE_VME) || cpu_has_tsc || cpu_has_de)
                clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
  
        load_current_idt();