1. 17 5月, 2019 1 次提交
  2. 15 5月, 2019 4 次提交
  3. 30 4月, 2019 9 次提交
  4. 27 4月, 2019 1 次提交
  5. 26 4月, 2019 4 次提交
    • J
      arm64: Always enable ssb vulnerability detection · d42281b6
      Jeremy Linton 提交于
      Ensure we are always able to detect whether or not the CPU is affected
      by SSB, so that we can later advertise this to userspace.
      Signed-off-by: NJeremy Linton <jeremy.linton@arm.com>
      Reviewed-by: NAndre Przywara <andre.przywara@arm.com>
      Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
      Tested-by: NStefan Wahren <stefan.wahren@i2se.com>
      [will: Use IS_ENABLED instead of #ifdef]
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      d42281b6
    • W
      arm64: futex: Avoid copying out uninitialised stack in failed cmpxchg() · 8e4e0ac0
      Will Deacon 提交于
      Returning an error code from futex_atomic_cmpxchg_inatomic() indicates
      that the caller should not make any use of *uval, and should instead act
      upon on the value of the error code. Although this is implemented
      correctly in our futex code, we needlessly copy uninitialised stack to
      *uval in the error case, which can easily be avoided.
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      8e4e0ac0
    • W
      arm64: futex: Bound number of LDXR/STXR loops in FUTEX_WAKE_OP · 03110a5c
      Will Deacon 提交于
      Our futex implementation makes use of LDXR/STXR loops to perform atomic
      updates to user memory from atomic context. This can lead to latency
      problems if we end up spinning around the LL/SC sequence at the expense
      of doing something useful.
      
      Rework our futex atomic operations so that we return -EAGAIN if we fail
      to update the futex word after 128 attempts. The core futex code will
      reschedule if necessary and we'll try again later.
      
      Cc: <stable@kernel.org>
      Fixes: 6170a974 ("arm64: Atomic operations")
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      03110a5c
    • W
      arm64: futex: Fix FUTEX_WAKE_OP atomic ops with non-zero result value · 84ff7a09
      Will Deacon 提交于
      Rather embarrassingly, our futex() FUTEX_WAKE_OP implementation doesn't
      explicitly set the return value on the non-faulting path and instead
      leaves it holding the result of the underlying atomic operation. This
      means that any FUTEX_WAKE_OP atomic operation which computes a non-zero
      value will be reported as having failed. Regrettably, I wrote the buggy
      code back in 2011 and it was upstreamed as part of the initial arm64
      support in 2012.
      
      The reasons we appear to get away with this are:
      
        1. FUTEX_WAKE_OP is rarely used and therefore doesn't appear to get
           exercised by futex() test applications
      
        2. If the result of the atomic operation is zero, the system call
           behaves correctly
      
        3. Prior to version 2.25, the only operation used by GLIBC set the
           futex to zero, and therefore worked as expected. From 2.25 onwards,
           FUTEX_WAKE_OP is not used by GLIBC at all.
      
      Fix the implementation by ensuring that the return value is either 0
      to indicate that the atomic operation completed successfully, or -EFAULT
      if we encountered a fault when accessing the user mapping.
      
      Cc: <stable@kernel.org>
      Fixes: 6170a974 ("arm64: Atomic operations")
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      84ff7a09
  6. 25 4月, 2019 1 次提交
    • K
      arm64: sysreg: Make mrs_s and msr_s macros work with Clang and LTO · be604c61
      Kees Cook 提交于
      Clang's integrated assembler does not allow assembly macros defined
      in one inline asm block using the .macro directive to be used across
      separate asm blocks. LLVM developers consider this a feature and not a
      bug, recommending code refactoring:
      
        https://bugs.llvm.org/show_bug.cgi?id=19749
      
      As binutils doesn't allow macros to be redefined, this change uses
      UNDEFINE_MRS_S and UNDEFINE_MSR_S to define corresponding macros
      in-place and workaround gcc and clang limitations on redefining macros
      across different assembler blocks.
      
      Specifically, the current state after preprocessing looks like this:
      
      asm volatile(".macro mXX_s ... .endm");
      void f()
      {
      	asm volatile("mXX_s a, b");
      }
      
      With GCC, it gives macro redefinition error because sysreg.h is included
      in multiple source files, and assembler code for all of them is later
      combined for LTO (I've seen an intermediate file with hundreds of
      identical definitions).
      
      With clang, it gives macro undefined error because clang doesn't allow
      sharing macros between inline asm statements.
      
      I also seem to remember catching another sort of undefined error with
      GCC due to reordering of macro definition asm statement and generated
      asm code for function that uses the macro.
      
      The solution with defining and undefining for each use, while certainly
      not elegant, satisfies both GCC and clang, LTO and non-LTO.
      Co-developed-by: NAlex Matveev <alxmtvv@gmail.com>
      Co-developed-by: NYury Norov <ynorov@caviumnetworks.com>
      Co-developed-by: NSami Tolvanen <samitolvanen@google.com>
      Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      be604c61
  7. 24 4月, 2019 3 次提交
  8. 19 4月, 2019 1 次提交
  9. 17 4月, 2019 1 次提交
  10. 16 4月, 2019 9 次提交
  11. 15 4月, 2019 1 次提交
  12. 13 4月, 2019 1 次提交
  13. 12 4月, 2019 1 次提交
    • W
      arm64: futex: Fix FUTEX_WAKE_OP atomic ops with non-zero result value · 045afc24
      Will Deacon 提交于
      Rather embarrassingly, our futex() FUTEX_WAKE_OP implementation doesn't
      explicitly set the return value on the non-faulting path and instead
      leaves it holding the result of the underlying atomic operation. This
      means that any FUTEX_WAKE_OP atomic operation which computes a non-zero
      value will be reported as having failed. Regrettably, I wrote the buggy
      code back in 2011 and it was upstreamed as part of the initial arm64
      support in 2012.
      
      The reasons we appear to get away with this are:
      
        1. FUTEX_WAKE_OP is rarely used and therefore doesn't appear to get
           exercised by futex() test applications
      
        2. If the result of the atomic operation is zero, the system call
           behaves correctly
      
        3. Prior to version 2.25, the only operation used by GLIBC set the
           futex to zero, and therefore worked as expected. From 2.25 onwards,
           FUTEX_WAKE_OP is not used by GLIBC at all.
      
      Fix the implementation by ensuring that the return value is either 0
      to indicate that the atomic operation completed successfully, or -EFAULT
      if we encountered a fault when accessing the user mapping.
      
      Cc: <stable@kernel.org>
      Fixes: 6170a974 ("arm64: Atomic operations")
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      045afc24
  14. 11 4月, 2019 1 次提交
    • V
      arm64: compat: Reduce address limit · d2631193
      Vincenzo Frascino 提交于
      Currently, compat tasks running on arm64 can allocate memory up to
      TASK_SIZE_32 (UL(0x100000000)).
      
      This means that mmap() allocations, if we treat them as returning an
      array, are not compliant with the sections 6.5.8 of the C standard
      (C99) which states that: "If the expression P points to an element of
      an array object and the expression Q points to the last element of the
      same array object, the pointer expression Q+1 compares greater than P".
      
      Redefine TASK_SIZE_32 to address the issue.
      
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: <stable@vger.kernel.org>
      Reported-by: NJann Horn <jannh@google.com>
      Signed-off-by: NVincenzo Frascino <vincenzo.frascino@arm.com>
      [will: fixed typo in comment]
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      d2631193
  15. 09 4月, 2019 2 次提交