Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Jul 2019 20:54:00 +0000 (13:54 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Jul 2019 20:54:00 +0000 (13:54 -0700)
Pull x86 fixes from Thomas Gleixner:
 "A collection of assorted fixes:

   - Fix for the pinned cr0/4 fallout which escaped all testing efforts
     because the kvm-intel module was never loaded when the kernel was
     compiled with CONFIG_PARAVIRT=n. The cr0/4 accessors are moved out
     of line and static key is now solely used in the core code and
     therefore can stay in the RO after init section. So the kvm-intel
     and other modules do not longer reference the (read only) static
     key which the module loader tried to update.

   - Prevent an infinite loop in arch_stack_walk_user() by breaking out
     of the loop once the return address is detected to be 0.

   - Prevent the int3_emulate_call() selftest from corrupting the stack
     when KASAN is enabled. KASASN clobbers more registers than covered
     by the emulated call implementation. Convert the int3_magic()
     selftest to a ASM function so the compiler cannot KASANify it.

   - Unbreak the build with old GCC versions and with the Gold linker by
     reverting the 'Move of _etext to the actual end of .text'. In both
     cases the build fails with 'Invalid absolute R_X86_64_32S
     relocation: _etext'

   - Initialize the context lock for init_mm, which was never an issue
     until the alternatives code started to use a temporary mm for
     patching.

   - Fix a build warning vs. the LOWMEM_PAGES constant where clang
     complains rightfully about a signed integer overflow in the shift
     operation by converting the operand to an ULL.

   - Adjust the misnamed ENDPROC() of common_spurious in the 32bit entry
     code"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/stacktrace: Prevent infinite loop in arch_stack_walk_user()
  x86/asm: Move native_write_cr0/4() out of line
  x86/pgtable/32: Fix LOWMEM_PAGES constant
  x86/alternatives: Fix int3_emulate_call() selftest stack corruption
  x86/entry/32: Fix ENDPROC of common_spurious
  Revert "x86/build: Move _etext to actual end of .text"
  x86/ldt: Initialize the context lock for init_mm

1  2 
arch/x86/kernel/vmlinux.lds.S

index 147cd020516a5d5504caf26b8a643bd5acb89f50,4d1517022a147bfd3b24a9577fe5f08edd12c225..e2feacf921a03abb949e221aafa899d4f2e042df
@@@ -141,10 -141,10 +141,10 @@@ SECTION
                *(.text.__x86.indirect_thunk)
                __indirect_thunk_end = .;
  #endif
-       } :text = 0x9090
  
-       /* End of text section */
-       _etext = .;
+               /* End of text section */
+               _etext = .;
+       } :text = 0x9090
  
        NOTES :text :note
  
                __bss_stop = .;
        }
  
 +      /*
 +       * The memory occupied from _text to here, __end_of_kernel_reserve, is
 +       * automatically reserved in setup_arch(). Anything after here must be
 +       * explicitly reserved using memblock_reserve() or it will be discarded
 +       * and treated as available memory.
 +       */
 +      __end_of_kernel_reserve = .;
 +
        . = ALIGN(PAGE_SIZE);
        .brk : AT(ADDR(.brk) - LOAD_OFFSET) {
                __brk_base = .;
        . = ALIGN(PAGE_SIZE);           /* keep VO_INIT_SIZE page aligned */
        _end = .;
  
 +#ifdef CONFIG_AMD_MEM_ENCRYPT
 +      /*
 +       * Early scratch/workarea section: Lives outside of the kernel proper
 +       * (_text - _end).
 +       *
 +       * Resides after _end because even though the .brk section is after
 +       * __end_of_kernel_reserve, the .brk section is later reserved as a
 +       * part of the kernel. Since it is located after __end_of_kernel_reserve
 +       * it will be discarded and become part of the available memory. As
 +       * such, it can only be used by very early boot code and must not be
 +       * needed afterwards.
 +       *
 +       * Currently used by SME for performing in-place encryption of the
 +       * kernel during boot. Resides on a 2MB boundary to simplify the
 +       * pagetable setup used for SME in-place encryption.
 +       */
 +      . = ALIGN(HPAGE_SIZE);
 +      .init.scratch : AT(ADDR(.init.scratch) - LOAD_OFFSET) {
 +              __init_scratch_begin = .;
 +              *(.init.scratch)
 +              . = ALIGN(HPAGE_SIZE);
 +              __init_scratch_end = .;
 +      }
 +#endif
 +
        STABS_DEBUG
        DWARF_DEBUG
  
 -      /* Sections to be discarded */
        DISCARDS
        /DISCARD/ : {
                *(.eh_frame)