1. 17 7月, 2019 3 次提交
  2. 13 7月, 2019 10 次提交
  3. 12 7月, 2019 1 次提交
    • N
      x86/vdso: Fix flip/flop vdso build bug · e9a1379f
      Naohiro Aota 提交于
      Two consecutive "make" on an already compiled kernel tree will show
      different behavior:
      
      $ make
        CALL    scripts/checksyscalls.sh
        CALL    scripts/atomic/check-atomics.sh
        DESCEND  objtool
        CHK     include/generated/compile.h
        VDSOCHK arch/x86/entry/vdso/vdso64.so.dbg
        VDSOCHK arch/x86/entry/vdso/vdso32.so.dbg
      Kernel: arch/x86/boot/bzImage is ready  (#3)
        Building modules, stage 2.
        MODPOST 12 modules
      
      $ make
      make
        CALL    scripts/checksyscalls.sh
        CALL    scripts/atomic/check-atomics.sh
        DESCEND  objtool
        CHK     include/generated/compile.h
        VDSO    arch/x86/entry/vdso/vdso64.so.dbg
        OBJCOPY arch/x86/entry/vdso/vdso64.so
        VDSO2C  arch/x86/entry/vdso/vdso-image-64.c
        CC      arch/x86/entry/vdso/vdso-image-64.o
        VDSO    arch/x86/entry/vdso/vdso32.so.dbg
        OBJCOPY arch/x86/entry/vdso/vdso32.so
        VDSO2C  arch/x86/entry/vdso/vdso-image-32.c
        CC      arch/x86/entry/vdso/vdso-image-32.o
        AR      arch/x86/entry/vdso/built-in.a
        AR      arch/x86/entry/built-in.a
        AR      arch/x86/built-in.a
        GEN     .version
        CHK     include/generated/compile.h
        UPD     include/generated/compile.h
        CC      init/version.o
        AR      init/built-in.a
        LD      vmlinux.o
      <snip>
      
      This is causing "LD vmlinux" once every two times even without any
      modifications. This is the same bug fixed in commit 92a47286
      ("x86/boot: Fix if_changed build flip/flop bug"). Two "if_changed" cannot
      be used in one target.
      
      Fix this merging two commands into one function.
      
      Fixes: 7ac87074 ("x86/vdso: Switch to generic vDSO implementation")
      Signed-off-by: NNaohiro Aota <naohiro.aota@wdc.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NVincenzo Frascino <vincenzo.frascino@arm.com>
      Reviewed-by: NVincenzo Frascino <vincenzo.frascino@arm.com>
      Reviewed-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Link: https://lkml.kernel.org/r/20190712101556.17833-1-naohiro.aota@wdc.com
      e9a1379f
  4. 11 7月, 2019 4 次提交
  5. 10 7月, 2019 3 次提交
    • 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
    • Y
      kvm: x86: Fix -Wmissing-prototypes warnings · cdc238eb
      Yi Wang 提交于
      We get a warning when build kernel W=1:
      
      arch/x86/kvm/../../../virt/kvm/eventfd.c:48:1: warning: no previous prototype for ‘kvm_arch_irqfd_allowed’ [-Wmissing-prototypes]
       kvm_arch_irqfd_allowed(struct kvm *kvm, struct kvm_irqfd *args)
       ^
      
      The reason is kvm_arch_irqfd_allowed() is declared in arch/x86/kvm/irq.h,
      which is not included by eventfd.c. Considering kvm_arch_irqfd_allowed()
      is a weakly defined function in eventfd.c, remove the declaration to
      kvm_host.h can fix this.
      Signed-off-by: NYi Wang <wang.yi59@zte.com.cn>
      Reviewed-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      cdc238eb
    • 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
  6. 09 7月, 2019 4 次提交
  7. 07 7月, 2019 2 次提交
    • S
      x86/fpu: Inline fpu__xstate_clear_all_cpu_caps() · 7891bc0a
      Sebastian Andrzej Siewior 提交于
      All fpu__xstate_clear_all_cpu_caps() does is to invoke one simple
      function since commit
      
        73e3a7d2 ("x86/fpu: Remove the explicit clearing of XSAVE dependent features")
      
      so invoke that function directly and remove the wrapper.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20190704060743.rvew4yrjd6n33uzx@linutronix.de
      7891bc0a
    • S
      x86/fpu: Make 'no387' and 'nofxsr' command line options useful · 9838e3bf
      Sebastian Andrzej Siewior 提交于
      The command line option `no387' is designed to disable the FPU
      entirely. This only 'works' with CONFIG_MATH_EMULATION enabled.
      
      But on 64bit this cannot work because user space expects SSE to work which
      required basic FPU support. MATH_EMULATION does not help because SSE is not
      emulated.
      
      The command line option `nofxsr' should also be limited to 32bit because
      FXSR is part of the required flags on 64bit so turning it off is not
      possible.
      
      Clearing X86_FEATURE_FPU without emulation enabled will not work anyway and
      hang in fpu__init_system_early_generic() before the console is enabled.
      
      Setting additioal dependencies, ensures that the CPU still boots on a
      modern CPU. Otherwise, dropping FPU will leave FXSR enabled causing the
      kernel to crash early in fpu__init_system_mxcsr().
      
      With XSAVE support it will crash in fpu__init_cpu_xstate(). The problem is
      that xsetbv() with XMM set and SSE cleared is not allowed.  That means
      XSAVE has to be disabled. The XSAVE support is disabled in
      fpu__init_system_xstate_size_legacy() but it is too late. It can be
      removed, it has been added in commit
      
        1f999ab5 ("x86, xsave: Disable xsave in i387 emulation mode")
      
      to use `no387' on a CPU with XSAVE support.
      
      All this happens before console output.
      
      After hat, the next possible crash is in RAID6 detect code because MMX
      remained enabled. With a 3DNOW enabled config it will explode in memcpy()
      for instance due to kernel_fpu_begin() but this is unconditionally enabled.
      
      This is enough to boot a Debian Wheezy on a 32bit qemu "host" CPU which
      supports everything up to XSAVES, AVX2 without 3DNOW. Later, Debian
      increased the minimum requirements to i686 which means it does not boot
      userland atleast due to CMOV.
      
      After masking the additional features it still keeps SSE4A and 3DNOW*
      enabled (if present on the host) but those are unused in the kernel.
      
      Restrict `no387' and `nofxsr' otions to 32bit only. Add dependencies for
      FPU, FXSR to additionaly mask CMOV, MMX, XSAVE if FXSR or FPU is cleared.
      Reported-by: NVegard Nossum <vegard.nossum@oracle.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20190703083247.57kjrmlxkai3vpw3@linutronix.de
      9838e3bf
  8. 06 7月, 2019 1 次提交
  9. 05 7月, 2019 12 次提交