1. 16 5月, 2020 7 次提交
  2. 08 5月, 2020 1 次提交
  3. 07 5月, 2020 2 次提交
    • M
      arm64: hugetlb: avoid potential NULL dereference · 027d0c71
      Mark Rutland 提交于
      The static analyzer in GCC 10 spotted that in huge_pte_alloc() we may
      pass a NULL pmdp into pte_alloc_map() when pmd_alloc() returns NULL:
      
      |   CC      arch/arm64/mm/pageattr.o
      |   CC      arch/arm64/mm/hugetlbpage.o
      |                  from arch/arm64/mm/hugetlbpage.c:10:
      | arch/arm64/mm/hugetlbpage.c: In function ‘huge_pte_alloc’:
      | ./arch/arm64/include/asm/pgtable-types.h:28:24: warning: dereference of NULL ‘pmdp’ [CWE-690] [-Wanalyzer-null-dereference]
      | ./arch/arm64/include/asm/pgtable.h:436:26: note: in expansion of macro ‘pmd_val’
      | arch/arm64/mm/hugetlbpage.c:242:10: note: in expansion of macro ‘pte_alloc_map’
      |     |arch/arm64/mm/hugetlbpage.c:232:10:
      |     |./arch/arm64/include/asm/pgtable-types.h:28:24:
      | ./arch/arm64/include/asm/pgtable.h:436:26: note: in expansion of macro ‘pmd_val’
      | arch/arm64/mm/hugetlbpage.c:242:10: note: in expansion of macro ‘pte_alloc_map’
      
      This can only occur when the kernel cannot allocate a page, and so is
      unlikely to happen in practice before other systems start failing.
      
      We can avoid this by bailing out if pmd_alloc() fails, as we do earlier
      in the function if pud_alloc() fails.
      
      Fixes: 66b3923a ("arm64: hugetlb: add support for PTE contiguous bit")
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Reported-by: NKyrill Tkachov <kyrylo.tkachov@arm.com>
      Cc: <stable@vger.kernel.org> # 4.5.x-
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      027d0c71
    • T
      ARM: futex: Address build warning · 8101b5a1
      Thomas Gleixner 提交于
      Stephen reported the following build warning on a ARM multi_v7_defconfig
      build with GCC 9.2.1:
      
      kernel/futex.c: In function 'do_futex':
      kernel/futex.c:1676:17: warning: 'oldval' may be used uninitialized in this function [-Wmaybe-uninitialized]
       1676 |   return oldval == cmparg;
            |          ~~~~~~~^~~~~~~~~
      kernel/futex.c:1652:6: note: 'oldval' was declared here
       1652 |  int oldval, ret;
            |      ^~~~~~
      
      introduced by commit a08971e9 ("futex: arch_futex_atomic_op_inuser()
      calling conventions change").
      
      While that change should not make any difference it confuses GCC which
      fails to work out that oldval is not referenced when the return value is
      not zero.
      
      GCC fails to properly analyze arch_futex_atomic_op_inuser(). It's not the
      early return, the issue is with the assembly macros. GCC fails to detect
      that those either set 'ret' to 0 and set oldval or set 'ret' to -EFAULT
      which makes oldval uninteresting. The store to the callsite supplied oldval
      pointer is conditional on ret == 0.
      
      The straight forward way to solve this is to make the store unconditional.
      
      Aside of addressing the build warning this makes sense anyway because it
      removes the conditional from the fastpath. In the error case the stored
      value is uninteresting and the extra store does not matter at all.
      Reported-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/87pncao2ph.fsf@nanos.tec.linutronix.de
      8101b5a1
  4. 06 5月, 2020 4 次提交
  5. 05 5月, 2020 9 次提交
  6. 04 5月, 2020 2 次提交
  7. 03 5月, 2020 1 次提交
  8. 02 5月, 2020 2 次提交
  9. 01 5月, 2020 3 次提交
    • M
      KVM: arm64: Fix 32bit PC wrap-around · 0225fd5e
      Marc Zyngier 提交于
      In the unlikely event that a 32bit vcpu traps into the hypervisor
      on an instruction that is located right at the end of the 32bit
      range, the emulation of that instruction is going to increment
      PC past the 32bit range. This isn't great, as userspace can then
      observe this value and get a bit confused.
      
      Conversly, userspace can do things like (in the context of a 64bit
      guest that is capable of 32bit EL0) setting PSTATE to AArch64-EL0,
      set PC to a 64bit value, change PSTATE to AArch32-USR, and observe
      that PC hasn't been truncated. More confusion.
      
      Fix both by:
      - truncating PC increments for 32bit guests
      - sanitizing all 32bit regs every time a core reg is changed by
        userspace, and that PSTATE indicates a 32bit mode.
      
      Cc: stable@vger.kernel.org
      Acked-by: NWill Deacon <will@kernel.org>
      Signed-off-by: NMarc Zyngier <maz@kernel.org>
      0225fd5e
    • R
      x86/mm/cpa: Flush direct map alias during cpa · ab513018
      Rick Edgecombe 提交于
      As an optimization, cpa_flush() was changed to optionally only flush
      the range in @cpa if it was small enough.  However, this range does
      not include any direct map aliases changed in cpa_process_alias(). So
      small set_memory_() calls that touch that alias don't get the direct
      map changes flushed. This situation can happen when the virtual
      address taking variants are passed an address in vmalloc or modules
      space.
      
      In these cases, force a full TLB flush.
      
      Note this issue does not extend to cases where the set_memory_() calls are
      passed a direct map address, or page array, etc, as the primary target. In
      those cases the direct map would be flushed.
      
      Fixes: 935f5839 ("x86/mm/cpa: Optimize cpa_flush_array() TLB invalidation")
      Signed-off-by: NRick Edgecombe <rick.p.edgecombe@intel.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20200424105343.GA20730@hirez.programming.kicks-ass.net
      ab513018
    • V
      arm64: vdso: Add -fasynchronous-unwind-tables to cflags · 1578e5d0
      Vincenzo Frascino 提交于
      On arm64 linux gcc uses -fasynchronous-unwind-tables -funwind-tables
      by default since gcc-8, so now the de facto platform ABI is to allow
      unwinding from async signal handlers.
      
      However on bare metal targets (aarch64-none-elf), and on old gcc,
      async and sync unwind tables are not enabled by default to avoid
      runtime memory costs.
      
      This means if linux is built with a baremetal toolchain the vdso.so
      may not have unwind tables which breaks the gcc platform ABI guarantee
      in userspace.
      
      Add -fasynchronous-unwind-tables explicitly to the vgettimeofday.o
      cflags to address the ABI change.
      
      Fixes: 28b1a824 ("arm64: vdso: Substitute gettimeofday() with C implementation")
      Cc: Will Deacon <will@kernel.org>
      Reported-by: NSzabolcs Nagy <szabolcs.nagy@arm.com>
      Signed-off-by: NVincenzo Frascino <vincenzo.frascino@arm.com>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      1578e5d0
  10. 30 4月, 2020 4 次提交
  11. 25 4月, 2020 5 次提交