1. 11 7月, 2018 1 次提交
    • J
      selftest: timers: Tweak raw_skew to SKIP when ADJ_OFFSET/other clock adjustments are in progress · 1416270f
      John Stultz 提交于
      In the past we've warned when ADJ_OFFSET was in progress, usually
      caused by ntpd or some other time adjusting daemon running in non
      steady sate, which can cause the skew calculations to be
      incorrect.
      
      Thus, this patch checks to see if the clock was being adjusted
      when we fail so that we don't cause false negatives.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Miroslav Lichvar <mlichvar@redhat.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: linux-kselftest@vger.kernel.org
      Suggested-by: NMiroslav Lichvar <mlichvar@redhat.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      ---
      v2: Widened the checks to look for other clock adjustments that
          could happen, as suggested by Miroslav
      v3: Fixed up commit message
      1416270f
  2. 27 6月, 2018 2 次提交
  3. 21 6月, 2018 4 次提交
  4. 20 6月, 2018 1 次提交
    • P
      rseq/selftests: Implement MIPS support · 744f4be5
      Paul Burton 提交于
      Implement support for both MIPS32 & MIPS64 in the rseq selftests, in
      order to sanity check the recently enabled rseq syscall.
      
      The tests all pass on a MIPS Boston development board running either a
      MIPS32r2 interAptiv CPU & a MIPS64r6 I6500 CPU, both of which were
      configured with 2 cores each of which have 2 hardware threads (VP(E)s) -
      ie. 4 CPUs.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Reviewed-by: NJames Hogan <jhogan@kernel.org>
      Patchwork: https://patchwork.linux-mips.org/patch/19524/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      744f4be5
  5. 18 6月, 2018 10 次提交
  6. 15 6月, 2018 3 次提交
  7. 13 6月, 2018 2 次提交
  8. 11 6月, 2018 1 次提交
    • A
      selftests: bpf: fix urandom_read build issue · 1c9ca7e9
      Anders Roxell 提交于
      gcc complains that urandom_read gets built twice.
      
      gcc -o tools/testing/selftests/bpf/urandom_read
      -static urandom_read.c -Wl,--build-id
      gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../lib/bpf
      -I../../../../include/generated  -I../../../include    urandom_read.c
      urandom_read -lcap -lelf -lrt -lpthread -o
      tools/testing/selftests/bpf/urandom_read
      gcc: fatal error: input file
      ‘tools/testing/selftests/bpf/urandom_read’ is the
      same as output file
      compilation terminated.
      ../lib.mk:110: recipe for target
      'tools/testing/selftests/bpf/urandom_read' failed
      To fix this issue remove the urandom_read target and so target
      TEST_CUSTOM_PROGS gets used.
      
      Fixes: 81f77fd0 ("bpf: add selftest for stackmap with BPF_F_STACK_BUILD_ID")
      Signed-off-by: NAnders Roxell <anders.roxell@linaro.org>
      Acked-by: NYonghong Song <yhs@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      1c9ca7e9
  9. 08 6月, 2018 5 次提交
    • A
      tools/testing/selftests/proc: test /proc/*/fd a bit (+ PF_KTHREAD is ABI!) · b2f5de03
      Alexey Dobriyan 提交于
      * Test lookup in /proc/self/fd.
        "map_files" lookup story showed that lookup is not that simple.
      
      * Test that all those symlinks open the same file.
        Check with (st_dev, st_info).
      
      * Test that kernel threads do not have anything in their /proc/*/fd/
        directory.
      
      Now this is where things get interesting.
      
      First, kernel threads aren't pinned by /proc/self or equivalent,
      thus some "atomicity" is required.
      
      Second, ->comm can contain whitespace and ')'.
      No, they are not escaped.
      
      Third, the only reliable way to check if process is kernel thread
      appears to be field #9 in /proc/*/stat.
      
      This field is struct task_struct::flags in decimal!
      Check is done by testing PF_KTHREAD flags like we do in kernel.
      
      	PF_KTREAD value is a part of userspace ABI !!!
      
      Other methods for determining kernel threadness are not reliable:
      * RSS can be 0 if everything is swapped, even while reading
        from /proc/self.
      
      * ->total_vm CAN BE ZERO if process is finishing
      
      	munmap(NULL, whole address space);
      
      * /proc/*/maps and similar files can be empty because unmapping
        everything works. Read returning 0 can't distinguish between
        kernel thread and such suicide process.
      
      Link: http://lkml.kernel.org/r/20180505000414.GA15090@avx2Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b2f5de03
    • Y
      tools/bpf: fix selftest get_cgroup_id_user · 23316a36
      Yonghong Song 提交于
      Commit f269099a ("tools/bpf: add a selftest for
      bpf_get_current_cgroup_id() helper") added a test
      for bpf_get_current_cgroup_id() helper. The bpf program
      is attached to tracepoint syscalls/sys_enter_nanosleep
      and will record the cgroup id if the tracepoint is hit.
      The test program creates a cgroup and attachs itself to
      this cgroup and expects that the test program process
      cgroup id is the same as the cgroup_id retrieved
      by the bpf program.
      
      In a light system where no other processes called
      nanosleep syscall, the test case can pass.
      In a busy system where many different processes can hit
      syscalls/sys_enter_nanosleep tracepoint, the cgroup id
      recorded by bpf program may not match the test program
      process cgroup_id.
      
      This patch fixed an issue by communicating the test program
      pid to bpf program. The bpf program only records
      cgroup id if the current task pid is the same as
      passed-in pid. This ensures that the recorded cgroup_id
      is for the cgroup within which the test program resides.
      
      Fixes: f269099a ("tools/bpf: add a selftest for bpf_get_current_cgroup_id() helper")
      Signed-off-by: NYonghong Song <yhs@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      23316a36
    • D
      kselftest/cgroup: fix a signedness bug · 53c3daf8
      Dan Carpenter 提交于
      "len" needs to be signed for the error handling to work.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NShuah Khan (Samsung OSG) <shuah@kernel.org>
      53c3daf8
    • N
      selftests/ftrace: Add ppc support for kprobe args tests · 9855c462
      Naveen N. Rao 提交于
      Add powerpc support for the recently added kprobe args tests.
      Signed-off-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Reviewed-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Acked-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: NShuah Khan (Samsung OSG) <shuah@kernel.org>
      9855c462
    • D
      bpf: reject passing modified ctx to helper functions · 58990d1f
      Daniel Borkmann 提交于
      As commit 28e33f9d ("bpf: disallow arithmetic operations on
      context pointer") already describes, f1174f77 ("bpf/verifier:
      rework value tracking") removed the specific white-listed cases
      we had previously where we would allow for pointer arithmetic in
      order to further generalize it, and allow e.g. context access via
      modified registers. While the dereferencing of modified context
      pointers had been forbidden through 28e33f9d, syzkaller did
      recently manage to trigger several KASAN splats for slab out of
      bounds access and use after frees by simply passing a modified
      context pointer to a helper function which would then do the bad
      access since verifier allowed it in adjust_ptr_min_max_vals().
      
      Rejecting arithmetic on ctx pointer in adjust_ptr_min_max_vals()
      generally could break existing programs as there's a valid use
      case in tracing in combination with passing the ctx to helpers as
      bpf_probe_read(), where the register then becomes unknown at
      verification time due to adding a non-constant offset to it. An
      access sequence may look like the following:
      
        offset = args->filename;  /* field __data_loc filename */
        bpf_probe_read(&dst, len, (char *)args + offset); // args is ctx
      
      There are two options: i) we could special case the ctx and as
      soon as we add a constant or bounded offset to it (hence ctx type
      wouldn't change) we could turn the ctx into an unknown scalar, or
      ii) we generalize the sanity test for ctx member access into a
      small helper and assert it on the ctx register that was passed
      as a function argument. Fwiw, latter is more obvious and less
      complex at the same time, and one case that may potentially be
      legitimate in future for ctx member access at least would be for
      ctx to carry a const offset. Therefore, fix follows approach
      from ii) and adds test cases to BPF kselftests.
      
      Fixes: f1174f77 ("bpf/verifier: rework value tracking")
      Reported-by: syzbot+3d0b2441dbb71751615e@syzkaller.appspotmail.com
      Reported-by: syzbot+c8504affd4fdd0c1b626@syzkaller.appspotmail.com
      Reported-by: syzbot+e5190cb881d8660fb1a3@syzkaller.appspotmail.com
      Reported-by: syzbot+efae31b384d5badbd620@syzkaller.appspotmail.com
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NYonghong Song <yhs@fb.com>
      Acked-by: NEdward Cree <ecree@solarflare.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      58990d1f
  10. 06 6月, 2018 7 次提交
    • M
      rseq/selftests: Provide Makefile, scripts, gitignore · ccba8b64
      Mathieu Desnoyers 提交于
      A run_param_test.sh script runs many variants of the parametrizable
      tests.
      
      Wire up the rseq Makefile, add directory entry into MAINTAINERS file.
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Joel Fernandes <joelaf@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dave Watson <davejwatson@fb.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Shuah Khan <shuahkh@osg.samsung.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: linux-kselftest@vger.kernel.org
      Cc: "H . Peter Anvin" <hpa@zytor.com>
      Cc: Chris Lameter <cl@linux.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Andrew Hunter <ahh@google.com>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ben Maurer <bmaurer@fb.com>
      Cc: linux-api@vger.kernel.org
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: https://lkml.kernel.org/r/20180602124408.8430-17-mathieu.desnoyers@efficios.com
      ccba8b64
    • M
      rseq/selftests: Provide parametrized tests · c960e990
      Mathieu Desnoyers 提交于
      "param_test" is a parametrizable restartable sequences test. See
      the "--help" output for usage.
      
      "param_test_benchmark" is the same as "param_test", but it removes
      testing book-keeping code to allow accurate benchmarks.
      
      "param_test_compare_twice" is the same as "param_test", but it performs
      each comparison within rseq critical section twice, thus validating
      invariants. If any of the second comparisons fails, an error message
      is printed and the test aborts.
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Joel Fernandes <joelaf@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dave Watson <davejwatson@fb.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Shuah Khan <shuahkh@osg.samsung.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: linux-kselftest@vger.kernel.org
      Cc: "H . Peter Anvin" <hpa@zytor.com>
      Cc: Chris Lameter <cl@linux.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Andrew Hunter <ahh@google.com>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ben Maurer <bmaurer@fb.com>
      Cc: linux-api@vger.kernel.org
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: https://lkml.kernel.org/r/20180602124408.8430-16-mathieu.desnoyers@efficios.com
      c960e990
    • M
      rseq/selftests: Provide basic percpu ops test · 01a5ec42
      Mathieu Desnoyers 提交于
      "basic_percpu_ops_test" is a slightly more "realistic" variant,
      implementing a few simple per-cpu operations and testing their
      correctness.
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Joel Fernandes <joelaf@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dave Watson <davejwatson@fb.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Shuah Khan <shuahkh@osg.samsung.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: linux-kselftest@vger.kernel.org
      Cc: "H . Peter Anvin" <hpa@zytor.com>
      Cc: Chris Lameter <cl@linux.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Andrew Hunter <ahh@google.com>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ben Maurer <bmaurer@fb.com>
      Cc: linux-api@vger.kernel.org
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: https://lkml.kernel.org/r/20180602124408.8430-15-mathieu.desnoyers@efficios.com
      01a5ec42
    • M
      rseq/selftests: Provide basic test · 1badac4f
      Mathieu Desnoyers 提交于
      "basic_test" only asserts that RSEQ works moderately correctly. E.g.
      that the CPUID pointer works.
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Joel Fernandes <joelaf@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dave Watson <davejwatson@fb.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Shuah Khan <shuahkh@osg.samsung.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: linux-kselftest@vger.kernel.org
      Cc: "H . Peter Anvin" <hpa@zytor.com>
      Cc: Chris Lameter <cl@linux.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Andrew Hunter <ahh@google.com>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ben Maurer <bmaurer@fb.com>
      Cc: linux-api@vger.kernel.org
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: https://lkml.kernel.org/r/20180602124408.8430-14-mathieu.desnoyers@efficios.com
      1badac4f
    • M
      rseq/selftests: Provide rseq library · 2e155fb7
      Mathieu Desnoyers 提交于
      This rseq helper library provides a user-space API to the rseq()
      system call.
      
      The rseq fast-path exposes the instruction pointer addresses where the
      rseq assembly blocks begin and end, as well as the associated abort
      instruction pointer, in the __rseq_table section. This section allows
      debuggers may know where to place breakpoints when single-stepping
      through assembly blocks which may be aborted at any point by the kernel.
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Joel Fernandes <joelaf@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dave Watson <davejwatson@fb.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Shuah Khan <shuahkh@osg.samsung.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: linux-kselftest@vger.kernel.org
      Cc: "H . Peter Anvin" <hpa@zytor.com>
      Cc: Chris Lameter <cl@linux.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Andrew Hunter <ahh@google.com>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ben Maurer <bmaurer@fb.com>
      Cc: linux-api@vger.kernel.org
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: https://lkml.kernel.org/r/20180602124408.8430-13-mathieu.desnoyers@efficios.com
      2e155fb7
    • M
      selftests/lib.mk: Introduce OVERRIDE_TARGETS · 4e49ed2f
      Mathieu Desnoyers 提交于
      Introduce OVERRIDE_TARGETS to allow tests to express dependencies on
      header files and .so, which require to override the selftests lib.mk
      targets.
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NShuah Khan <shuahkh@osg.samsung.com>
      Cc: Joel Fernandes <joelaf@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dave Watson <davejwatson@fb.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: linux-kselftest@vger.kernel.org
      Cc: "H . Peter Anvin" <hpa@zytor.com>
      Cc: Chris Lameter <cl@linux.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Andrew Hunter <ahh@google.com>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ben Maurer <bmaurer@fb.com>
      Cc: linux-api@vger.kernel.org
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: https://lkml.kernel.org/r/20180602124408.8430-12-mathieu.desnoyers@efficios.com
      4e49ed2f
    • T
      selftests: sparc64: char: Selftest for privileged ADI driver · 3c545084
      Tom Hromatka 提交于
      Add a selftest for the sparc64 privileged ADI driver.  These
      tests verify the read(), pread(), write(), pwrite(), and seek()
      functionality of the driver.  The tests also report simple
      performance statistics:
      
              Syscall Call    AvgTime AvgSize
                      Count   (ticks) (bytes)
              -------------------------------
              read          3  119638    8133
              pread         4  118164    6741
              write         3  339442    8133
              pwrite        4  280134    6741
              seek         10    2919       0
              Pass 8 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0
      Signed-off-by: NTom Hromatka <tom.hromatka@oracle.com>
      Reviewed-by: NAllen Pais <allen.pais@oracle.com>
      Reviewed-by: NShuah Khan (Samsung OSG) <shuah@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3c545084
  11. 05 6月, 2018 1 次提交
  12. 04 6月, 2018 3 次提交