1. 28 5月, 2020 1 次提交
    • A
      selftests: add openat2(2) selftests · 5f7d3758
      Aleksa Sarai 提交于
      to #26323588
      
      commit b28a10aedcd4d175470171a32f4f20b0a60a612b upstream.
      
      Test all of the various openat2(2) flags. A small stress-test of a
      symlink-rename attack is included to show that the protections against
      ".."-based attacks are sufficient.
      
      The main things these self-tests are enforcing are:
      
        * The struct+usize ABI for openat2(2) and copy_struct_from_user() to
          ensure that upgrades will be handled gracefully (in addition,
          ensuring that misaligned structures are also handled correctly).
      
        * The -EINVAL checks for openat2(2) are all correctly handled to avoid
          userspace passing unknown or conflicting flag sets (most
          importantly, ensuring that invalid flag combinations are checked).
      
        * All of the RESOLVE_* semantics (including errno values) are
          correctly handled with various combinations of paths and flags.
      
        * RESOLVE_IN_ROOT correctly protects against the symlink rename(2)
          attack that has been responsible for several CVEs (and likely will
          be responsible for several more).
      
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: NAleksa Sarai <cyphar@cyphar.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
      Acked-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
      5f7d3758
  2. 15 1月, 2020 3 次提交
  3. 13 12月, 2019 3 次提交
    • B
      selftests/powerpc: Skip test instead of failing · 5aba7739
      Breno Leitao 提交于
      [ Upstream commit eafcd8e3fbad4f426a40ed2b6a8c697c3a4ef36a ]
      
      Current core-pkey selftest fails if the test runs without privileges to
      write into the core pattern file (/proc/sys/kernel/core_pattern). This
      causes the test to fail and give the impression that the subsystem being
      tested is broken, when, in fact, the test is being executed without the
      proper privileges. This is the current error:
      
      	test: core_pkey
      	tags: git_version:v4.19-3-g9e3363be9bce-dirty
      	Error writing to core_pattern file: Permission denied
      	failure: core_pkey
      
      This patch simply skips this test if it runs without the proper privileges,
      avoiding this undesired failure.
      
      CC: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
      CC: Thiago Jung Bauermann <bauerman@linux.ibm.com>
      Signed-off-by: NBreno Leitao <leitao@debian.org>
      Reviewed-by: NThiago Jung Bauermann <bauerman@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      5aba7739
    • B
      selftests/powerpc: Allocate base registers · 104d0d63
      Breno Leitao 提交于
      [ Upstream commit 5249497a7bb6334fcc128588d6a7e1e21786515a ]
      
      Some ptrace selftests are passing input operands using a constraint that
      can allocate any register for the operand, and using these registers on
      load/store operations.
      
      If the register allocated by the compiler happens to be zero (r0), it might
      cause an invalid memory address access, since load and store operations
      consider the content of 0x0 address if the base register is r0, instead of
      the content of the r0 register. For example:
      
      	r1 := 0xdeadbeef
      	r0 := 0xdeadbeef
      
      	ld r2, 0(1) /* will load into r2 the content of r1 address */
      	ld r2, 0(0) /* will load into r2 the content of 0x0 */
      
      In order to avoid this possible problem, the inline assembly constraint
      should be aware that these registers will be used as a base register, thus,
      r0 should not be allocated.
      
      Other than that, this patch removes inline assembly operands that are not
      used by the tests.
      Signed-off-by: NBreno Leitao <leitao@debian.org>
      Reviewed-by: NSegher Boessenkool <segher@kernel.crashing.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      104d0d63
    • V
      selftests: kvm: fix build with glibc >= 2.30 · a806e2a3
      Vitaly Kuznetsov 提交于
      [ Upstream commit e37f9f139f62deddff90c7298ae3a85026a71067 ]
      
      Glibc-2.30 gained gettid() wrapper, selftests fail to compile:
      
      lib/assert.c:58:14: error: static declaration of ‘gettid’ follows non-static declaration
         58 | static pid_t gettid(void)
            |              ^~~~~~
      In file included from /usr/include/unistd.h:1170,
                       from include/test_util.h:18,
                       from lib/assert.c:10:
      /usr/include/bits/unistd_ext.h:34:16: note: previous declaration of ‘gettid’ was here
         34 | extern __pid_t gettid (void) __THROW;
            |                ^~~~~~
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      a806e2a3
  4. 05 12月, 2019 1 次提交
  5. 01 12月, 2019 12 次提交
  6. 24 11月, 2019 4 次提交
  7. 21 11月, 2019 1 次提交
    • B
      selftests/powerpc: Do not fail with reschedule · a3581509
      Breno Leitao 提交于
      [ Upstream commit 44d947eff19d64384efc06069509db7a0a1103b0 ]
      
      There are cases where the test is not expecting to have the transaction
      aborted, but, the test process might have been rescheduled, either in the
      OS level or by KVM (if it is running on a KVM guest machine). The process
      reschedule will cause a treclaim/recheckpoint which will cause the
      transaction to doom, aborting the transaction as soon as the process is
      rescheduled back to the CPU. This might cause the test to fail, but this is
      not a failure in essence.
      
      If that is the case, TEXASR[FC] is indicated with either
      TM_CAUSE_RESCHEDULE or TM_CAUSE_KVM_RESCHEDULE for KVM interruptions.
      
      In this scenario, ignore these two failures and avoid the whole test to
      return failure.
      Signed-off-by: NBreno Leitao <leitao@debian.org>
      Reviewed-by: NGustavo Romero <gromero@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      a3581509
  8. 10 11月, 2019 4 次提交
  9. 12 10月, 2019 1 次提交
  10. 08 10月, 2019 1 次提交
  11. 21 9月, 2019 1 次提交
  12. 16 9月, 2019 1 次提交
  13. 10 9月, 2019 2 次提交
  14. 29 8月, 2019 4 次提交
  15. 07 8月, 2019 1 次提交