1. 28 6月, 2019 3 次提交
  2. 22 6月, 2019 1 次提交
    • A
      x86/vdso: Prevent segfaults due to hoisted vclock reads · ff17bbe0
      Andy Lutomirski 提交于
      GCC 5.5.0 sometimes cleverly hoists reads of the pvclock and/or hvclock
      pages before the vclock mode checks.  This creates a path through
      vclock_gettime() in which no vclock is enabled at all (due to disabled
      TSC on old CPUs, for example) but the pvclock or hvclock page
      nevertheless read.  This will segfault on bare metal.
      
      This fixes commit 459e3a21 ("gcc-9: properly declare the
      {pv,hv}clock_page storage") in the sense that, before that commit, GCC
      didn't seem to generate the offending code.  There was nothing wrong
      with that commit per se, and -stable maintainers should backport this to
      all supported kernels regardless of whether the offending commit was
      present, since the same crash could just as easily be triggered by the
      phase of the moon.
      
      On GCC 9.1.1, this doesn't seem to affect the generated code at all, so
      I'm not too concerned about performance regressions from this fix.
      
      Cc: stable@vger.kernel.org
      Cc: x86@kernel.org
      Cc: Borislav Petkov <bp@alien8.de>
      Reported-by: NDuncan Roe <duncan_roe@optusnet.com.au>
      Signed-off-by: NAndy Lutomirski <luto@kernel.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ff17bbe0
  3. 21 6月, 2019 2 次提交
    • J
      ARM: 8867/1: vdso: pass --be8 to linker if necessary · c5d0e49e
      Jason A. Donenfeld 提交于
      The commit fe00e50b ("ARM: 8858/1: vdso: use $(LD) instead of $(CC)
      to link VDSO") removed the passing of CFLAGS, since ld doesn't take
      those directly. However, prior, big-endian ARM was relying on gcc to
      translate its -mbe8 option into ld's --be8 option. Lacking this, ld
      generated be32 code, making the VDSO generate SIGILL when called by
      userspace.
      
      This commit passes --be8 if CONFIG_CPU_ENDIAN_BE8 is enabled.
      Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      c5d0e49e
    • P
      KVM: nVMX: reorganize initial steps of vmx_set_nested_state · 9fd58877
      Paolo Bonzini 提交于
      Commit 332d0797 ("KVM: nVMX: KVM_SET_NESTED_STATE - Tear down old EVMCS
      state before setting new state", 2019-05-02) broke evmcs_test because the
      eVMCS setup must be performed even if there is no VMXON region defined,
      as long as the eVMCS bit is set in the assist page.
      
      While the simplest possible fix would be to add a check on
      kvm_state->flags & KVM_STATE_NESTED_EVMCS in the initial "if" that
      covers kvm_state->hdr.vmx.vmxon_pa == -1ull, that is quite ugly.
      
      Instead, this patch moves checks earlier in the function and
      conditionalizes them on kvm_state->hdr.vmx.vmxon_pa, so that
      vmx_set_nested_state always goes through vmx_leave_nested
      and nested_enable_evmcs.
      
      Fixes: 332d0797 ("KVM: nVMX: KVM_SET_NESTED_STATE - Tear down old EVMCS state before setting new state")
      Cc: Aaron Lewis <aaronlewis@google.com>
      Reviewed-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      9fd58877
  4. 20 6月, 2019 1 次提交
    • S
      KVM: PPC: Book3S HV: Invalidate ERAT when flushing guest TLB entries · 50087112
      Suraj Jitindar Singh 提交于
      When a guest vcpu moves from one physical thread to another it is
      necessary for the host to perform a tlb flush on the previous core if
      another vcpu from the same guest is going to run there. This is because the
      guest may use the local form of the tlb invalidation instruction meaning
      stale tlb entries would persist where it previously ran. This is handled
      on guest entry in kvmppc_check_need_tlb_flush() which calls
      flush_guest_tlb() to perform the tlb flush.
      
      Previously the generic radix__local_flush_tlb_lpid_guest() function was
      used, however the functionality was reimplemented in flush_guest_tlb()
      to avoid the trace_tlbie() call as the flushing may be done in real
      mode. The reimplementation in flush_guest_tlb() was missing an erat
      invalidation after flushing the tlb.
      
      This lead to observable memory corruption in the guest due to the
      caching of stale translations. Fix this by adding the erat invalidation.
      
      Fixes: 70ea13f6 ("KVM: PPC: Book3S HV: Flush TLB on secondary radix threads")
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      50087112
  5. 19 6月, 2019 18 次提交
  6. 18 6月, 2019 7 次提交
    • M
      arm64/mm: don't initialize pgd_cache twice · 615c48ad
      Mike Rapoport 提交于
      When PGD_SIZE != PAGE_SIZE, arm64 uses kmem_cache for allocation of PGD
      memory. That cache was initialized twice: first through
      pgtable_cache_init() alias and then as an override for weak
      pgd_cache_init().
      
      Remove the alias from pgtable_cache_init() and keep the only pgd_cache
      initialization in pgd_cache_init().
      
      Fixes: caa84136 ("x86/mm: Initialize PGD cache during mm initialization")
      Signed-off-by: NMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      615c48ad
    • A
      arm64/sve: <uapi/asm/ptrace.h> should not depend on <uapi/linux/prctl.h> · 35341ca0
      Anisse Astier 提交于
      Pulling linux/prctl.h into asm/ptrace.h in the arm64 UAPI headers causes
      userspace build issues for any program (e.g. strace and qemu) that
      includes both <sys/prctl.h> and <linux/ptrace.h> when using musl libc:
      
        | error: redefinition of 'struct prctl_mm_map'
        |  struct prctl_mm_map {
      
      See https://github.com/foundriesio/meta-lmp/commit/6d4a106e191b5d79c41b9ac78fd321316d3013c0
      for a public example of people working around this issue.
      
      Although it's a bit grotty, fix this breakage by duplicating the prctl
      constant definitions. Since these are part of the kernel ABI, they
      cannot be changed in future and so it's not the end of the world to have
      them open-coded.
      
      Fixes: 43d4da2c ("arm64/sve: ptrace and ELF coredump support")
      Cc: stable@vger.kernel.org
      Acked-by: NDave Martin <Dave.Martin@arm.com>
      Signed-off-by: NAnisse Astier <aastier@freebox.fr>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      35341ca0
    • A
      ARM: ixp4xx: include irqs.h where needed · 140d9009
      Arnd Bergmann 提交于
      Multiple ixp4xx specific files require macros from irqs.h that
      were moved out from mach/irqs.h, e.g.:
      
      arch/arm/mach-ixp4xx/vulcan-pci.c:41:19: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
      arch/arm/mach-ixp4xx/vulcan-pci.c:49:10: error: implicit declaration of function 'IXP4XX_GPIO_IRQ' [-Werror,-Wimplicit-function-declaration]
                      return IXP4XX_GPIO_IRQ(INTA);
      
      Include this header in all files that failed to build because of
      that.
      
      Fixes: dc8ef8cd ("ARM: ixp4xx: Convert to SPARSE_IRQ")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NOlof Johansson <olof@lixom.net>
      140d9009
    • A
      ARM: ixp4xx: don't select SERIAL_OF_PLATFORM · 6d8df602
      Arnd Bergmann 提交于
      Platforms should not normally select all the device drivers, leave that
      up to the user and the defconfig file.
      
      In this case, we get a warning for randconfig builds:
      
      WARNING: unmet direct dependencies detected for SERIAL_OF_PLATFORM
        Depends on [n]: TTY [=y] && HAS_IOMEM [=y] && SERIAL_8250 [=n] && OF [=y]
        Selected by [y]:
        - MACH_IXP4XX_OF [=y] && ARCH_IXP4XX [=y]
      
      Fixes: 9540724c ("ARM: ixp4xx: Add device tree boot support")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NOlof Johansson <olof@lixom.net>
      6d8df602
    • S
      KVM: PPC: Book3S HV: Only write DAWR[X] when handling h_set_dawr in real mode · 84b02824
      Suraj Jitindar Singh 提交于
      The hcall H_SET_DAWR is used by a guest to set the data address
      watchpoint register (DAWR). This hcall is handled in the host in
      kvmppc_h_set_dawr() which can be called in either real mode on the
      guest exit path from hcall_try_real_mode() in book3s_hv_rmhandlers.S,
      or in virtual mode when called from kvmppc_pseries_do_hcall() in
      book3s_hv.c.
      
      The function kvmppc_h_set_dawr() updates the dawr and dawrx fields in
      the vcpu struct accordingly and then also writes the respective values
      into the DAWR and DAWRX registers directly. It is necessary to write
      the registers directly here when calling the function in real mode
      since the path to re-enter the guest won't do this. However when in
      virtual mode the host DAWR and DAWRX values have already been
      restored, and so writing the registers would overwrite these.
      Additionally there is no reason to write the guest values here as
      these will be read from the vcpu struct and written to the registers
      appropriately the next time the vcpu is run.
      
      This also avoids the case when handling h_set_dawr for a nested guest
      where the guest hypervisor isn't able to write the DAWR and DAWRX
      registers directly and must rely on the real hypervisor to do this for
      it when it calls H_ENTER_NESTED.
      
      Fixes: c1fe190c ("powerpc: Add force enable of DAWR on P9 option")
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      84b02824
    • M
      KVM: PPC: Book3S HV: Fix r3 corruption in h_set_dabr() · fabb2efc
      Michael Neuling 提交于
      Commit c1fe190c ("powerpc: Add force enable of DAWR on P9 option")
      screwed up some assembler and corrupted a pointer in r3. This resulted
      in crashes like the below:
      
        BUG: Kernel NULL pointer dereference at 0x000013bf
        Faulting instruction address: 0xc00000000010b044
        Oops: Kernel access of bad area, sig: 11 [#1]
        LE PAGE_SIZE=64K MMU=Radix MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
        CPU: 8 PID: 1771 Comm: qemu-system-ppc Kdump: loaded Not tainted 5.2.0-rc4+ #3
        NIP:  c00000000010b044 LR: c0080000089dacf4 CTR: c00000000010aff4
        REGS: c00000179b397710 TRAP: 0300   Not tainted  (5.2.0-rc4+)
        MSR:  800000000280b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE>  CR: 42244842  XER: 00000000
        CFAR: c00000000010aff8 DAR: 00000000000013bf DSISR: 42000000 IRQMASK: 0
        GPR00: c0080000089dd6bc c00000179b3979a0 c008000008a04300 ffffffffffffffff
        GPR04: 0000000000000000 0000000000000003 000000002444b05d c0000017f11c45d0
        ...
        NIP kvmppc_h_set_dabr+0x50/0x68
        LR  kvmppc_pseries_do_hcall+0xa3c/0xeb0 [kvm_hv]
        Call Trace:
          0xc0000017f11c0000 (unreliable)
          kvmppc_vcpu_run_hv+0x694/0xec0 [kvm_hv]
          kvmppc_vcpu_run+0x34/0x48 [kvm]
          kvm_arch_vcpu_ioctl_run+0x2f4/0x400 [kvm]
          kvm_vcpu_ioctl+0x460/0x850 [kvm]
          do_vfs_ioctl+0xe4/0xb40
          ksys_ioctl+0xc4/0x110
          sys_ioctl+0x28/0x80
          system_call+0x5c/0x70
        Instruction dump:
        4082fff4 4c00012c 38600000 4e800020 e96280c0 896b0000 2c2b0000 3860ffff
        4d820020 50852e74 508516f6 78840724 <f88313c0> f8a313c8 7c942ba6 7cbc2ba6
      
      Fix the bug by only changing r3 when we are returning immediately.
      
      Fixes: c1fe190c ("powerpc: Add force enable of DAWR on P9 option")
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Reported-by: NCédric Le Goater <clg@kaod.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      fabb2efc
    • A
      arm64: ssbd: explicitly depend on <linux/prctl.h> · adeaa21a
      Anisse Astier 提交于
      Fix ssbd.c which depends implicitly on asm/ptrace.h including
      linux/prctl.h (through for example linux/compat.h, then linux/time.h,
      linux/seqlock.h, linux/spinlock.h and linux/irqflags.h), and uses
      PR_SPEC* defines.
      
      This is an issue since we'll soon be removing the include from
      asm/ptrace.h.
      
      Fixes: 9cdc0108 ("arm64: ssbd: Add prctl interface for per-thread mitigation")
      Cc: stable@vger.kernel.org
      Signed-off-by: NAnisse Astier <aastier@freebox.fr>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      adeaa21a
  7. 17 6月, 2019 5 次提交
  8. 15 6月, 2019 3 次提交