1. 13 7月, 2019 34 次提交
  2. 11 7月, 2019 2 次提交
  3. 10 7月, 2019 2 次提交
    • A
      x86/pgtable/32: Fix LOWMEM_PAGES constant · 26515699
      Arnd Bergmann 提交于
      clang points out that the computation of LOWMEM_PAGES causes a signed
      integer overflow on 32-bit x86:
      
      arch/x86/kernel/head32.c:83:20: error: signed shift result (0x100000000) requires 34 bits to represent, but 'int' only has 32 bits [-Werror,-Wshift-overflow]
                      (PAGE_TABLE_SIZE(LOWMEM_PAGES) << PAGE_SHIFT);
                                       ^~~~~~~~~~~~
      arch/x86/include/asm/pgtable_32.h:109:27: note: expanded from macro 'LOWMEM_PAGES'
       #define LOWMEM_PAGES ((((2<<31) - __PAGE_OFFSET) >> PAGE_SHIFT))
                               ~^ ~~
      arch/x86/include/asm/pgtable_32.h:98:34: note: expanded from macro 'PAGE_TABLE_SIZE'
       #define PAGE_TABLE_SIZE(pages) ((pages) / PTRS_PER_PGD)
      
      Use the _ULL() macro to make it a 64-bit constant.
      
      Fixes: 1e620f9b ("x86/boot/32: Convert the 32-bit pgtable setup code from assembly to C")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20190710130522.1802800-1-arnd@arndb.de
      26515699
    • P
      x86/alternatives: Fix int3_emulate_call() selftest stack corruption · ecc60610
      Peter Zijlstra 提交于
      KASAN shows the following splat during boot:
      
        BUG: KASAN: unknown-crash in unwind_next_frame+0x3f6/0x490
        Read of size 8 at addr ffffffff84007db0 by task swapper/0
      
        CPU: 0 PID: 0 Comm: swapper Tainted: G                T 5.2.0-rc6-00013-g7457c0da #1
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
        Call Trace:
         dump_stack+0x19/0x1b
         print_address_description+0x1b0/0x2b2
         __kasan_report+0x10f/0x171
         kasan_report+0x12/0x1c
         __asan_load8+0x54/0x81
         unwind_next_frame+0x3f6/0x490
         unwind_next_frame+0x1b/0x23
         arch_stack_walk+0x68/0xa5
         stack_trace_save+0x7b/0xa0
         save_trace+0x3c/0x93
         mark_lock+0x1ef/0x9b1
         lock_acquire+0x122/0x221
         __mutex_lock+0xb6/0x731
         mutex_lock_nested+0x16/0x18
         _vm_unmap_aliases+0x141/0x183
         vm_unmap_aliases+0x14/0x16
         change_page_attr_set_clr+0x15e/0x2f2
         set_memory_4k+0x2a/0x2c
         check_bugs+0x11fd/0x1298
         start_kernel+0x793/0x7eb
         x86_64_start_reservations+0x55/0x76
         x86_64_start_kernel+0x87/0xaa
         secondary_startup_64+0xa4/0xb0
      
        Memory state around the buggy address:
         ffffffff84007c80: 00 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1
         ffffffff84007d00: f1 00 00 00 00 00 00 00 00 00 f2 f2 f2 f3 f3 f3
        >ffffffff84007d80: f3 79 be 52 49 79 be 00 00 00 00 00 00 00 00 f1
      
      It turns out that int3_selftest() is corrupting the stack.  The problem is
      that the KASAN-ified version of int3_magic() is much less trivial than the
      C code appears.  It clobbers several unexpected registers.  So when the
      selftest's INT3 is converted to an emulated call to int3_magic(), the
      registers are clobbered and Bad Things happen when the function returns.
      
      Fix this by converting int3_magic() to the trivial ASM function it should
      be, avoiding all calling convention issues. Also add ASM_CALL_CONSTRAINT to
      the INT3 ASM, since it contains a 'CALL'.
      
      [peterz: cribbed changelog from josh]
      
      Fixes: 7457c0da ("x86/alternatives: Add int3_emulate_call() selftest")
      Reported-by: Nkernel test robot <rong.a.chen@intel.com>
      Debugged-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Link: https://lkml.kernel.org/r/20190709125744.GB3402@hirez.programming.kicks-ass.net
      ecc60610
  4. 09 7月, 2019 2 次提交