1. 26 8月, 2019 6 次提交
  2. 25 8月, 2019 1 次提交
  3. 23 8月, 2019 2 次提交
    • S
      x86/retpoline: Don't clobber RFLAGS during CALL_NOSPEC on i386 · b63f20a7
      Sean Christopherson 提交于
      Use 'lea' instead of 'add' when adjusting %rsp in CALL_NOSPEC so as to
      avoid clobbering flags.
      
      KVM's emulator makes indirect calls into a jump table of sorts, where
      the destination of the CALL_NOSPEC is a small blob of code that performs
      fast emulation by executing the target instruction with fixed operands.
      
        adcb_al_dl:
           0x000339f8 <+0>:   adc    %dl,%al
           0x000339fa <+2>:   ret
      
      A major motiviation for doing fast emulation is to leverage the CPU to
      handle consumption and manipulation of arithmetic flags, i.e. RFLAGS is
      both an input and output to the target of CALL_NOSPEC.  Clobbering flags
      results in all sorts of incorrect emulation, e.g. Jcc instructions often
      take the wrong path.  Sans the nops...
      
        asm("push %[flags]; popf; " CALL_NOSPEC " ; pushf; pop %[flags]\n"
           0x0003595a <+58>:  mov    0xc0(%ebx),%eax
           0x00035960 <+64>:  mov    0x60(%ebx),%edx
           0x00035963 <+67>:  mov    0x90(%ebx),%ecx
           0x00035969 <+73>:  push   %edi
           0x0003596a <+74>:  popf
           0x0003596b <+75>:  call   *%esi
           0x000359a0 <+128>: pushf
           0x000359a1 <+129>: pop    %edi
           0x000359a2 <+130>: mov    %eax,0xc0(%ebx)
           0x000359b1 <+145>: mov    %edx,0x60(%ebx)
      
        ctxt->eflags = (ctxt->eflags & ~EFLAGS_MASK) | (flags & EFLAGS_MASK);
           0x000359a8 <+136>: mov    -0x10(%ebp),%eax
           0x000359ab <+139>: and    $0x8d5,%edi
           0x000359b4 <+148>: and    $0xfffff72a,%eax
           0x000359b9 <+153>: or     %eax,%edi
           0x000359bd <+157>: mov    %edi,0x4(%ebx)
      
      For the most part this has gone unnoticed as emulation of guest code
      that can trigger fast emulation is effectively limited to MMIO when
      running on modern hardware, and MMIO is rarely, if ever, accessed by
      instructions that affect or consume flags.
      
      Breakage is almost instantaneous when running with unrestricted guest
      disabled, in which case KVM must emulate all instructions when the guest
      has invalid state, e.g. when the guest is in Big Real Mode during early
      BIOS.
      
      Fixes: 776b043848fd2 ("x86/retpoline: Add initial retpoline support")
      Fixes: 1a29b5b7 ("KVM: x86: Make indirect calls in emulator speculation safe")
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/20190822211122.27579-1-sean.j.christopherson@intel.com
      b63f20a7
    • J
      um: fix time travel mode · e0917f87
      Johannes Berg 提交于
      Unfortunately, my build fix for when time travel mode isn't
      enabled broke time travel mode, because I forgot that we need
      to use the timer time after the timer has been marked disabled,
      and thus need to leave the time stored instead of zeroing it.
      
      Fix that by splitting the inline into two, so we can call only
      the _mode() one in the relevant code path.
      
      Fixes: b482e48d ("um: fix build without CONFIG_UML_TIME_TRAVEL_SUPPORT")
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      e0917f87
  4. 22 8月, 2019 1 次提交
  5. 21 8月, 2019 3 次提交
  6. 20 8月, 2019 2 次提交
    • C
      arm: select the dma-noncoherent symbols for all swiotlb builds · 936376f8
      Christoph Hellwig 提交于
      We need to provide the arch hooks for non-coherent dma-direct
      and swiotlb for all swiotlb builds, not just when LPAS is enabled.
      Without that the Xen build that selects SWIOTLB indirectly through
      SWIOTLB_XEN fails to build.
      
      Fixes: ad3c7b18 ("arm: use swiotlb for bounce buffering on LPAE configs")
      Reported-by: NStefan Wahren <wahrenst@gmx.net>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Tested-by: NStefan Wahren <wahrenst@gmx.net>
      936376f8
    • T
      x86/CPU/AMD: Clear RDRAND CPUID bit on AMD family 15h/16h · c49a0a80
      Tom Lendacky 提交于
      There have been reports of RDRAND issues after resuming from suspend on
      some AMD family 15h and family 16h systems. This issue stems from a BIOS
      not performing the proper steps during resume to ensure RDRAND continues
      to function properly.
      
      RDRAND support is indicated by CPUID Fn00000001_ECX[30]. This bit can be
      reset by clearing MSR C001_1004[62]. Any software that checks for RDRAND
      support using CPUID, including the kernel, will believe that RDRAND is
      not supported.
      
      Update the CPU initialization to clear the RDRAND CPUID bit for any family
      15h and 16h processor that supports RDRAND. If it is known that the family
      15h or family 16h system does not have an RDRAND resume issue or that the
      system will not be placed in suspend, the "rdrand=force" kernel parameter
      can be used to stop the clearing of the RDRAND CPUID bit.
      
      Additionally, update the suspend and resume path to save and restore the
      MSR C001_1004 value to ensure that the RDRAND CPUID setting remains in
      place after resuming from suspend.
      
      Note, that clearing the RDRAND CPUID bit does not prevent a processor
      that normally supports the RDRAND instruction from executing it. So any
      code that determined the support based on family and model won't #UD.
      Signed-off-by: NTom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: Andrew Cooper <andrew.cooper3@citrix.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Chen Yu <yu.c.chen@intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: "linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>
      Cc: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
      Cc: Nathan Chancellor <natechancellor@gmail.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: <stable@vger.kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "x86@kernel.org" <x86@kernel.org>
      Link: https://lkml.kernel.org/r/7543af91666f491547bd86cebb1e17c66824ab9f.1566229943.git.thomas.lendacky@amd.com
      c49a0a80
  7. 19 8月, 2019 3 次提交
  8. 17 8月, 2019 2 次提交
  9. 16 8月, 2019 1 次提交
  10. 15 8月, 2019 2 次提交
    • V
      riscv: Make __fstate_clean() work correctly. · 69703eb9
      Vincent Chen 提交于
      Make the __fstate_clean() function correctly set the
      state of sstatus.FS in pt_regs to SR_FS_CLEAN.
      
      Fixes: 7db91e57 ("RISC-V: Task implementation")
      Cc: linux-stable <stable@vger.kernel.org>
      Signed-off-by: NVincent Chen <vincent.chen@sifive.com>
      Reviewed-by: NAnup Patel <anup@brainfault.org>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      [paul.walmsley@sifive.com: expanded "Fixes" commit ID]
      Signed-off-by: NPaul Walmsley <paul.walmsley@sifive.com>
      69703eb9
    • V
      riscv: Correct the initialized flow of FP register · 8ac71d7e
      Vincent Chen 提交于
        The following two reasons cause FP registers are sometimes not
      initialized before starting the user program.
      1. Currently, the FP context is initialized in flush_thread() function
         and we expect these initial values to be restored to FP register when
         doing FP context switch. However, the FP context switch only occurs in
         switch_to function. Hence, if this process does not be scheduled out
         and scheduled in before entering the user space, the FP registers
         have no chance to initialize.
      2. In flush_thread(), the state of reg->sstatus.FS inherits from the
         parent. Hence, the state of reg->sstatus.FS may be dirty. If this
         process is scheduled out during flush_thread() and initializing the
         FP register, the fstate_save() in switch_to will corrupt the FP context
         which has been initialized until flush_thread().
      
        To solve the 1st case, the initialization of the FP register will be
      completed in start_thread(). It makes sure all FP registers are initialized
      before starting the user program. For the 2nd case, the state of
      reg->sstatus.FS in start_thread will be set to SR_FS_OFF to prevent this
      process from corrupting FP context in doing context save. The FP state is
      set to SR_FS_INITIAL in start_trhead().
      Signed-off-by: NVincent Chen <vincent.chen@sifive.com>
      Reviewed-by: NAnup Patel <anup@brainfault.org>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Fixes: 7db91e57 ("RISC-V: Task implementation")
      Cc: stable@vger.kernel.org
      [paul.walmsley@sifive.com: fixed brace alignment issue reported by
       checkpatch]
      Signed-off-by: NPaul Walmsley <paul.walmsley@sifive.com>
      8ac71d7e
  11. 14 8月, 2019 5 次提交
  12. 13 8月, 2019 4 次提交
    • W
      arm64: cpufeature: Don't treat granule sizes as strict · 5717fe5a
      Will Deacon 提交于
      If a CPU doesn't support the page size for which the kernel is
      configured, then we will complain and refuse to bring it online. For
      secondary CPUs (and the boot CPU on a system booting with EFI), we will
      also print an error identifying the mismatch.
      
      Consequently, the only time that the cpufeature code can detect a
      granule size mismatch is for a granule other than the one that is
      currently being used. Although we would rather such systems didn't
      exist, we've unfortunately lost that battle and Kevin reports that
      on his amlogic S922X (odroid-n2 board) we end up warning and taining
      with defconfig because 16k pages are not supported by all of the CPUs.
      
      In such a situation, we don't actually care about the feature mismatch,
      particularly now that KVM only exposes the sanitised view of the CPU
      registers (commit 93390c0a - "arm64: KVM: Hide unsupported AArch64
      CPU features from guests"). Treat the granule fields as non-strict and
      let Kevin run without a tainted kernel.
      
      Cc: Marc Zyngier <maz@kernel.org>
      Reported-by: NKevin Hilman <khilman@baylibre.com>
      Tested-by: NKevin Hilman <khilman@baylibre.com>
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Acked-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NWill Deacon <will@kernel.org>
      [catalin.marinas@arm.com: changelog updated with KVM sanitised regs commit]
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      5717fe5a
    • M
      xtensa: add missing isync to the cpu_reset TLB code · cd8869f4
      Max Filippov 提交于
      ITLB entry modifications must be followed by the isync instruction
      before the new entries are possibly used. cpu_reset lacks one isync
      between ITLB way 6 initialization and jump to the identity mapping.
      Add missing isync to xtensa cpu_reset.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NMax Filippov <jcmvbkbc@gmail.com>
      cd8869f4
    • T
      x86/fpu/math-emu: Address fallthrough warnings · 91be2587
      Thomas Gleixner 提交于
      /home/tglx/work/kernel/linus/linux/arch/x86/math-emu/errors.c: In function ‘FPU_printall’:
      /home/tglx/work/kernel/linus/linux/arch/x86/math-emu/errors.c:187:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
          tagi = FPU_Special(r);
          ~~~~~^~~~~~~~~~~~~~~~
      /home/tglx/work/kernel/linus/linux/arch/x86/math-emu/errors.c:188:3: note: here
         case TAG_Valid:
         ^~~~
      /home/tglx/work/kernel/linus/linux/arch/x86/math-emu/fpu_trig.c: In function ‘fyl2xp1’:
      /home/tglx/work/kernel/linus/linux/arch/x86/math-emu/fpu_trig.c:1353:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
          if (denormal_operand() < 0)
             ^
      /home/tglx/work/kernel/linus/linux/arch/x86/math-emu/fpu_trig.c:1356:3: note: here
         case TAG_Zero:
      
      Remove the pointless 'break;' after 'continue;' while at it.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      91be2587
    • B
      x86/apic/32: Fix yet another implicit fallthrough warning · 5785675d
      Borislav Petkov 提交于
      Fix
      
        arch/x86/kernel/apic/probe_32.c: In function ‘default_setup_apic_routing’:
        arch/x86/kernel/apic/probe_32.c:146:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
            if (!APIC_XAPIC(version)) {
               ^
        arch/x86/kernel/apic/probe_32.c:151:3: note: here
         case X86_VENDOR_HYGON:
         ^~~~
      
      for 32-bit builds.
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20190811154036.29805-1-bp@alien8.de
      5785675d
  13. 12 8月, 2019 3 次提交
  14. 11 8月, 2019 2 次提交
  15. 10 8月, 2019 3 次提交
    • G
      ARM: ep93xx: Mark expected switch fall-through · 1f7585f3
      Gustavo A. R. Silva 提交于
      Mark switch cases where we are expecting to fall through.
      
      Fix the following warnings (Building: arm-ep93xx_defconfig arm):
      
      arch/arm/mach-ep93xx/crunch.c: In function 'crunch_do':
      arch/arm/mach-ep93xx/crunch.c:46:3: warning: this statement may
      fall through [-Wimplicit-fallthrough=]
            memset(crunch_state, 0, sizeof(*crunch_state));
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         arch/arm/mach-ep93xx/crunch.c:53:2: note: here
           case THREAD_NOTIFY_EXIT:
           ^~~~
      
      Notice that, in this particular case, the code comment is
      modified in accordance with what GCC is expecting to find.
      Reported-by: Nkbuild test robot <lkp@intel.com>
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      1f7585f3
    • G
      ARM: signal: Mark expected switch fall-through · e9d81fc5
      Gustavo A. R. Silva 提交于
      Mark switch cases where we are expecting to fall through.
      
      This patch fixes the following warning:
      
      arch/arm/kernel/signal.c: In function 'do_signal':
      arch/arm/kernel/signal.c:598:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
          restart -= 2;
          ~~~~~~~~^~~~
      arch/arm/kernel/signal.c:599:3: note: here
         case -ERESTARTNOHAND:
         ^~~~
      Reported-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      e9d81fc5
    • G
      ARM: OMAP: dma: Mark expected switch fall-throughs · 3da6bd94
      Gustavo A. R. Silva 提交于
      Mark switch cases where we are expecting to fall through.
      
      This patch fixes the following warnings:
      
      arch/arm/plat-omap/dma.c: In function 'omap_set_dma_src_burst_mode':
      arch/arm/plat-omap/dma.c:384:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
         if (dma_omap2plus()) {
            ^
      arch/arm/plat-omap/dma.c:393:2: note: here
        case OMAP_DMA_DATA_BURST_16:
        ^~~~
      arch/arm/plat-omap/dma.c:394:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
         if (dma_omap2plus()) {
            ^
      arch/arm/plat-omap/dma.c:402:2: note: here
        default:
        ^~~~~~~
      arch/arm/plat-omap/dma.c: In function 'omap_set_dma_dest_burst_mode':
      arch/arm/plat-omap/dma.c:473:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
         if (dma_omap2plus()) {
            ^
      arch/arm/plat-omap/dma.c:481:2: note: here
        default:
        ^~~~~~~
      
      Notice that, in this particular case, the code comment is
      modified in accordance with what GCC is expecting to find.
      Reported-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      3da6bd94