Commit c6c9161d064d30e78904f3affe5184487493e0fc

Authored by Linus Torvalds

Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner:
 "Misc fixes:
   - gold linker build fix
   - noxsave command line parsing fix
   - bugfix for NX setup
   - microcode resume path bug fix
   - _TIF_NOHZ versus TIF_NOHZ bugfix as discussed in the mysterious
     lockup thread"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86, syscall: Fix _TIF_NOHZ handling in syscall_trace_enter_phase1
  x86, kaslr: Handle Gold linker for finding bss/brk
  x86, mm: Set NX across entire PMD at boot
  x86, microcode: Update BSPs microcode on resume
  x86: Require exact match for 'noxsave' command line option

Showing 5 changed files Side-by-side Diff

arch/x86/kernel/cpu/common.c
... ... @@ -146,6 +146,8 @@
146 146  
147 147 static int __init x86_xsave_setup(char *s)
148 148 {
  149 + if (strlen(s))
  150 + return 0;
149 151 setup_clear_cpu_cap(X86_FEATURE_XSAVE);
150 152 setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT);
151 153 setup_clear_cpu_cap(X86_FEATURE_XSAVES);
arch/x86/kernel/cpu/microcode/core.c
... ... @@ -465,6 +465,14 @@
465 465  
466 466 if (uci->valid && uci->mc)
467 467 microcode_ops->apply_microcode(cpu);
  468 + else if (!uci->mc)
  469 + /*
  470 + * We might resume and not have applied late microcode but still
  471 + * have a newer patch stashed from the early loader. We don't
  472 + * have it in uci->mc so we have to load it the same way we're
  473 + * applying patches early on the APs.
  474 + */
  475 + load_ucode_ap();
468 476 }
469 477  
470 478 static struct syscore_ops mc_syscore_ops = {
arch/x86/kernel/ptrace.c
... ... @@ -1484,7 +1484,7 @@
1484 1484 */
1485 1485 if (work & _TIF_NOHZ) {
1486 1486 user_exit();
1487   - work &= ~TIF_NOHZ;
  1487 + work &= ~_TIF_NOHZ;
1488 1488 }
1489 1489  
1490 1490 #ifdef CONFIG_SECCOMP
arch/x86/mm/init_64.c
... ... @@ -1123,7 +1123,7 @@
1123 1123 unsigned long end = (unsigned long) &__end_rodata_hpage_align;
1124 1124 unsigned long text_end = PFN_ALIGN(&__stop___ex_table);
1125 1125 unsigned long rodata_end = PFN_ALIGN(&__end_rodata);
1126   - unsigned long all_end = PFN_ALIGN(&_end);
  1126 + unsigned long all_end;
1127 1127  
1128 1128 printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
1129 1129 (end - start) >> 10);
1130 1130  
... ... @@ -1134,7 +1134,16 @@
1134 1134 /*
1135 1135 * The rodata/data/bss/brk section (but not the kernel text!)
1136 1136 * should also be not-executable.
  1137 + *
  1138 + * We align all_end to PMD_SIZE because the existing mapping
  1139 + * is a full PMD. If we would align _brk_end to PAGE_SIZE we
  1140 + * split the PMD and the reminder between _brk_end and the end
  1141 + * of the PMD will remain mapped executable.
  1142 + *
  1143 + * Any PMD which was setup after the one which covers _brk_end
  1144 + * has been zapped already via cleanup_highmem().
1137 1145 */
  1146 + all_end = roundup((unsigned long)_brk_end, PMD_SIZE);
1138 1147 set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT);
1139 1148  
1140 1149 rodata_test();
arch/x86/tools/calc_run_size.pl
... ... @@ -19,7 +19,16 @@
19 19 if ($file_offset == 0) {
20 20 $file_offset = $offset;
21 21 } elsif ($file_offset != $offset) {
22   - die ".bss and .brk lack common file offset\n";
  22 + # BFD linker shows the same file offset in ELF.
  23 + # Gold linker shows them as consecutive.
  24 + next if ($file_offset + $mem_size == $offset + $size);
  25 +
  26 + printf STDERR "file_offset: 0x%lx\n", $file_offset;
  27 + printf STDERR "mem_size: 0x%lx\n", $mem_size;
  28 + printf STDERR "offset: 0x%lx\n", $offset;
  29 + printf STDERR "size: 0x%lx\n", $size;
  30 +
  31 + die ".bss and .brk are non-contiguous\n";
23 32 }
24 33 }
25 34 }