aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-06-30selftests: breakpoints: breakpoint_test_arm64: convert test to use TAP13Shuah Khan1-36/+58
Convert breakpoint_test_arm64 output to TAP13 format. Use ksft_* var arg msg api to include strerror() info. in the output. Change output from child process to use ksft_print_msg() instead of ksft_exit_* to avoid double counting tests and ensure parent process does the test counter incrementing. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-30selftests: breakpoints: step_after_suspend_test use ksft_* var arg msg apiShuah Khan1-26/+33
Use ksft_* var arg msg to include strerror() info. in test output and simplify test_result and exit_* using var arg msg api. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-30selftests: breakpoint_test: use ksft_* var arg msg apiShuah Khan1-12/+16
Use ksft_* var arg msg to include strerror() info. in test output. Change output from child process to use ksft_print_msg() instead of ksft_exit_* to avoid double counting tests and ensure parent does the incrementing test counters. Also includes unused variable cleanup. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-30kselftest: add ksft_print_msg() function to output general informationPaul Elder1-0/+10
Add a generic information output function: ksft_print_msg() Signed-off-by: Paul Elder <paul.elder@pitt.edu> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-30kselftest: make ksft_* output functions variadicPaul Elder1-12/+43
Make the ksft_* output functions variadic to allow string formatting directly in these functions. Signed-off-by: Paul Elder <paul.elder@pitt.edu> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-30selftests/capabilities: Fix the test_execve testAndy Lutomirski1-5/+2
test_execve does rather odd mount manipulations to safely create temporary setuid and setgid executables that aren't visible to the rest of the system. Those executables end up in the test's cwd, but that cwd is MNT_DETACHed. The core namespace code considers MNT_DETACHed trees to belong to no mount namespace at all and, in general, MNT_DETACHed trees are only barely function. This interacted with commit 380cf5ba6b0a ("fs: Treat foreign mounts as nosuid") to cause all MNT_DETACHed trees to act as though they're nosuid, breaking the test. Fix it by just not detaching the tree. It's still in a private mount namespace and is therefore still invisible to the rest of the system (except via /proc, and the same nosuid logic will protect all other programs on the system from believing in test_execve's setuid bits). While we're at it, fix some blatant whitespace problems. Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org> Fixes: 380cf5ba6b0a ("fs: Treat foreign mounts as nosuid") Cc: stable@vger.kernel.org Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Kees Cook <keescook@chromium.org> Cc: Shuah Khan <shuahkh@osg.samsung.com> Cc: Greg KH <greg@kroah.com> Cc: linux-kselftest@vger.kernel.org Signed-off-by: Andy Lutomirski <luto@kernel.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-30selftests: intel_pstate: add .gitignoreShuah Khan1-0/+2
Add .gitignore for generated files. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-30selftests: fix memory-hotplug testPo-Hsu Lin1-16/+54
In the memory offline test, the $ration was used with RANDOM as the possibility to get it offlined, correct it to become the portion of available removable memory blocks. Also ask the tool to try to offline the next available memory block if the attempt is unsuccessful. It will only fail if all removable memory blocks are busy. A nice example: $ sudo ./test.sh Test scope: 10% hotplug memory online all hot-pluggable memory in offline state: SKIPPED - no hot-pluggable memory in offline state offline 10% hot-pluggable memory in online state trying to offline 3 out of 28 memory block(s): online->offline memory1 online->offline memory10 ./test.sh: line 74: echo: write error: Resource temporarily unavailable offline_memory_expect_success 10: unexpected fail online->offline memory100 online->offline memory101 online all hot-pluggable memory in offline state: offline->online memory1 offline->online memory100 offline->online memory101 skip extra tests: debugfs is not mounted $ echo $? 0 Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-30selftests: add missing test name in memory-hotplug testPo-Hsu Lin1-0/+1
There is no prompt for testing memory notifier error injection, added with the same echo format of other tests above. Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-30selftests: check percentage range for memory-hotplug testPo-Hsu Lin1-0/+4
Check the precentage range for -r flag in memory-hotplug test. Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-30selftests: check hot-pluggagble memory for memory-hotplug testPo-Hsu Lin1-0/+5
Check for hot-pluggable memory availability in prerequisite() of the memory-hotplug test. Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-30selftests: typo correction for memory-hotplug testPo-Hsu Lin1-5/+5
Typo fixed for hotpluggable_offline_memory() in memory-hotplug test. Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-30selftests: ftrace: Use md5sum to take less time of checking logsMasami Hiramatsu1-3/+3
Use md5sum so that it takes less time of checking trace logs update. Since busybox tail/cat takes too long time to read the trace log, this uses md5sum to check whether trace log is updated or not. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-27tools/testing/selftests/sysctl: Add pre-check to the value of writes_strictOrson Zhai3-2/+24
Sysctl test will fail in some items if the value of /proc/sys/kernel /sysctrl_writes_strict is 0 as the default value in kernel older than v4.5. Make this test more robus and compatible with older kernel by checking and update writes_strict value and restore it when test is done. Signed-off-by: Orson Zhai <orson.zhai@linaro.org> Reviewed-by: Sumit Semwal <sumit.semwal@linaro.org> Tested-by: Sumit Semwal <sumit.semwal@linaro.org> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-23selftest/net/Makefile: Specify output with $(OUTPUT)SeongJae Park1-2/+1
After commit a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT"), net selftest build fails because it points output file without $(OUTPUT) yet. This commit fixes the error. Signed-off-by: SeongJae Park <sj38.park@gmail.com> Fixes: a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT") Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-23selftest/intel_pstate/aperf: Use LDLIBS instead of LDFLAGSSeongJae Park1-1/+1
Build of aperf fails as below: ``` gcc -Wall -D_GNU_SOURCE -lm aperf.c -o /tools/testing/selftests/intel_pstate/aperf /tmp/ccKf3GF6.o: In function `main': aperf.c:(.text+0x278): undefined reference to `sqrt' collect2: error: ld returned 1 exit status ``` The faulure occurs because -lm was defined as LDFLAGS and implicit rule of make places LDFLAGS before source file. This commit fixes the problem by using LDLIBS instead of LDFLAGS. Signed-off-by: SeongJae Park <sj38.park@gmail.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-23selftest/memfd/Makefile: Fix build errorSeongJae Park1-1/+1
Selftest for memfd shows build error as below: ``` gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/ -I../../../../include/ -I../../../../usr/include/ fuse_mnt.c -o /home/sjpark/linux/tools/testing/selftests/memfd/fuse_mnt /tmp/cc6NHdwJ.o: In function `main': fuse_mnt.c:(.text+0x249): undefined reference to `fuse_main_real' collect2: error: ld returned 1 exit status ``` The build fails because output file is specified without $(OUTPUT) and LDFLAGS is used though Makefile implicit rule is used. This commit fixes the error by specifying output file path with $(OUTPUT) and using LDLIBS instead of LDFLAGS. Signed-off-by: SeongJae Park <sj38.park@gmail.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-23selftests: lib: Skip tests on missing test modulesSumit Semwal2-0/+8
With older kernels, printf.sh and bitmap.sh fail because they can't find the respective test modules they are looking for. Use modprobe dry run to check for missing test_XXX module. Error out with the same error code as prime_numbers.sh. Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-15kselftest: membarrier: make test names more informativeAlice Ferrazzi1-2/+2
Make membarrier test names more informative. Signed-off-by: Alice Ferrazzi <alice.ferrazzi@gmail.com> Signed-off-by: Paul Elder <paul.elder@pitt.edu> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-15kselftest: make callers of ksft_exit_skip() output the reason for skippingPaul Elder3-8/+6
Make the three tests that did use the old ksft_ext_skip() (breakpoints/breakpoint_test_arm64, breakpoints/step_after_suspend_test, and membarrier_test) use the new one, with an output for the reason for skipping all the tests. Signed-off-by: Paul Elder <paul.elder@pitt.edu> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-15kselftest: make ksft_exit_skip() output a reason for skippingPaul Elder1-2/+5
Make ksft_exit_skip() input an optional message string as the reason for skipping all the tests and outputs it prior to exiting. Signed-off-by: Paul Elder <paul.elder@pitt.edu> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-14kselftest: convert get_size to use stricter TAP13 formatTim Bird1-11/+16
1. Add the TAP13 header 2. remove variable data from the test description line 3. move the plan count to the end of the file, for consistency with other kselftests 4. convert memory data from diagnostic (comment) format, to a YAML block Signed-off-by: Tim Bird <tim.bird@sony.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-13kselftest: breakpoints: convert step_after_suspend_test to TAP13 outputPaul Elder1-26/+17
Make the step_after_suspend test output in the TAP13 format by using the TAP13 output functions defined in kselftest.h Signed-off-by: Paul Elder <paul.elder@pitt.edu> Signed-off-by: Alice Ferrazzi <alice.ferrazzi@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-13kselftest: breakpoints: convert breakpoint_test to TAP13 outputPaul Elder1-14/+15
Make the breakpoints test output in the TAP13 format by using the TAP13 output functions defined in kselftest.h Signed-off-by: Paul Elder <paul.elder@pitt.edu> Signed-off-by: Alice Ferrazzi <alice.ferrazzi@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-13kselftest: membarrier: convert to TAP13 outputPaul Elder1-16/+19
Make the membarrier test output in the TAP13 format by using the TAP13 output functions defined in kselftest.h Signed-off-by: Paul Elder <paul.elder@pitt.edu> Signed-off-by: Alice Ferrazzi <alice.ferrazzi@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-13kselftest: add TAP13 conformant versions of ksft_* functionsPaul Elder1-4/+48
Add TAP13 conformat output functions to kselftest.h. Also add exit functions that output TAP13 exiting text, as well as functions to keep track of testing progress. Signed-off-by: Paul Elder <paul.elder@pitt.edu> Signed-off-by: Alice Ferrazzi <alice.ferrazzi@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-12selftests: kselftest_harness: Fix compile warningMickaël Salaün1-1/+1
Do not confuse the compiler with a semicolon preceding a block. Replace the semicolon with an empty block to avoid a warning: gcc -Wl,-no-as-needed -Wall -lpthread seccomp_bpf.c -o /.../linux/tools/testing/selftests/seccomp/seccomp_bpf In file included from seccomp_bpf.c:40:0: seccomp_bpf.c: In function ‘change_syscall’: ../kselftest_harness.h:558:2: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] for (; _metadata->trigger; _metadata->trigger = __bail(_assert)) ^ ../kselftest_harness.h:574:14: note: in expansion of macro ‘OPTIONAL_HANDLER’ } while (0); OPTIONAL_HANDLER(_assert) ^~~~~~~~~~~~~~~~ ../kselftest_harness.h:440:2: note: in expansion of macro ‘__EXPECT’ __EXPECT(expected, seen, ==, 0) ^~~~~~~~ seccomp_bpf.c:1313:2: note: in expansion of macro ‘EXPECT_EQ’ EXPECT_EQ(0, ret); ^~~~~~~~~ seccomp_bpf.c:1317:2: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘for’ { ^ Signed-off-by: Mickaël Salaün <mic@digikod.net> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Kees Cook <keescook@chromium.org> Cc: Shuah Khan <shuahkh@osg.samsung.com> Cc: Will Drewry <wad@chromium.org> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07selftests/ftrace: Return unsupported if it detects older kernelMasami Hiramatsu2-0/+18
Return unsupported if the kernel is too old to support instance independent ftrace filter for some testcases. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07selftests/ftrace: Use top-level available_filter_functionMasami Hiramatsu1-0/+4
Use top-level available_filter_function if the test case is running under an instance. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07selftests/ftrace: Add instance indication in test logMasami Hiramatsu1-1/+1
Add instance test indication in test log too. Current ftracetest shows instance test indication on the list of test, but not in the log for each test. This adds instance test indication on the top of each log, like below; execute (instance) : /ftrace/test.d/ftrace/func_set_ftrace_file.tc Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07selftests/ftrace: Reset ftrace filter on older kernelMasami Hiramatsu1-1/+4
Since older kernel didn't support separated instance of set_ftrace_filter, if the test case set the filter in an instance, it will propagate to top-level instance. This means that the filter setting remains even if we remove the instance, and will cause other tests failure. To avoid this issue, reset the ftrace filter if we detect the propagation. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07ftrace/kprobes: selftests: Check kretprobe maxactive is supportedMasami Hiramatsu1-0/+1
Check the kretprobe maxactive is supported by kprobe_events interface. To ensure the kernel feature, this changes ftrace README to describe it. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07selftests/ftrace: Reduce trace buffer checking overheadMasami Hiramatsu1-2/+6
Current event/toplevel-enable.tc checking the trace buffer by dumping all events while recording events. However, this makes system very busy. To reduce this overhead comes from reading trace buffer and recording trace buffer, use head instead of cat and stop tracing while reading. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07selftests/ftrace: Skip full-glob-matching filter test on older kernelMasami Hiramatsu1-11/+17
Skip a part of ftrace filter test related to full-glob matching if we are sure that the testing kernel is so old that it does not support full-glob-matching yet. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07selftests/seccomp: Force rebuild according to dependenciesMickaël Salaün1-0/+2
Rebuild the seccomp tests when kselftest_harness.h is updated. Signed-off-by: Mickaël Salaün <mic@digikod.net> Acked-by: Kees Cook <keescook@chromium.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Shuah Khan <shuah@kernel.org> Cc: Will Drewry <wad@chromium.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07Documentation/dev-tools: Add kselftest_harness documentationMickaël Salaün1-85/+330
Add ReST metadata to kselftest_harness.h to be able to include the comments in the Sphinx documentation. Signed-off-by: Mickaël Salaün <mic@digikod.net> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Kees Cook <keescook@chromium.org> Cc: Shuah Khan <shuah@kernel.org> Cc: Will Drewry <wad@chromium.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07selftests: Remove the TEST_API() wrapper from kselftest_harness.hMickaël Salaün1-205/+150
Remove the TEST_API() wrapper to expose the underlying macro arguments to the documentation tools. Signed-off-by: Mickaël Salaün <mic@digikod.net> Acked-by: Kees Cook <keescook@chromium.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Kees Cook <keescook@chromium.org> Cc: Shuah Khan <shuah@kernel.org> Cc: Will Drewry <wad@chromium.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07selftests: Cosmetic renames in kselftest_harness.hMickaël Salaün1-5/+6
Keep the content consistent with the new name. Signed-off-by: Mickaël Salaün <mic@digikod.net> Acked-by: Kees Cook <keescook@chromium.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Shuah Khan <shuah@kernel.org> Cc: Will Drewry <wad@chromium.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07selftests: Make test_harness.h more generally availableMickaël Salaün2-1/+1
The seccomp/test_harness.h file contains useful helpers to build tests. Moving it to the selftest directory should benefit to other test components. Keep seccomp maintainers for this file. Signed-off-by: Mickaël Salaün <mic@digikod.net> Acked-by: Kees Cook <keescook@chromium.org> Acked-by: Will Drewry <wad@chromium.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Shuah Khan <shuah@kernel.org> Link: https://lkml.kernel.org/r/CAGXu5j+8CVz8vL51DRYXqOY=xc3zuKFf=PTENe88XYHzFYidUQ@mail.gmail.com Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07selftests: sync: Skip the test if kernel support is not foundMichael Ellerman1-0/+13
The "Sync framework" test doesn't work if the kernel has no support, obviously. Rather than reporting a failure, check for the kernel support by looking for /sys/kernel/debug/sync/sw_sync, and if not found skip the test. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07selftests/vm: Fix test for virtual address range mapping for arm64Michal Suchanek1-9/+26
Arm64 has 256TB address space so fix the test to pass on Arm as well. Also remove unneeded numaif header. Signed-off-by: Michal Suchanek <msuchanek@suse.de> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07selftests: futex: print testcase-name and PASS/FAIL/ERROR statusNaresh Kamboju8-10/+19
Most of the tests under selftests follow a pattern for their results, which can then be parsed easily by other external tools easily. Though futex tests do print the test results very well, it doesn't really follow the general selftests pattern. This patch makes necessary changes to fix that. Output before this patch: futex_requeue_pi: Test requeue functionality Arguments: broadcast=0 locked=0 owner=0 timeout=0ns Result: PASS Output after this patch: futex_requeue_pi: Test requeue functionality Arguments: broadcast=0 locked=0 owner=0 timeout=0ns selftests: futex-requeue-pi [PASS] Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-05-27Merge tag 'powerpc-4.12-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linuxLinus Torvalds1-1/+1
Pull powerpc fixes from Michael Ellerman: "Fix running SPU programs on Cell, and a few other minor fixes. Thanks to Alistair Popple, Jeremy Kerr, Michael Neuling, Nicholas Piggin" * tag 'powerpc-4.12-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc: Add PPC_FEATURE userspace bits for SCV and DARN instructions powerpc/spufs: Fix hash faults for kernel regions powerpc: Fix booting P9 hash with CONFIG_PPC_RADIX_MMU=N powerpc/powernv/npu-dma.c: Fix opal_npu_destroy_context() call selftests/powerpc: Fix TM resched DSCR test with some compilers
2017-05-27Merge tag 'trace-v4.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-traceLinus Torvalds1-0/+21
Pull ftrace fixes from Steven Rostedt: "There's been a few memory issues found with ftrace. One was simply a memory leak where not all was being freed that should have been in releasing a file pointer on set_graph_function. Then Thomas found that the ftrace trampolines were marked for read/write as well as execute. To shrink the possible attack surface, he added calls to set them to ro. Which also uncovered some other issues with freeing module allocated memory that had its permissions changed. Kprobes had a similar issue which is fixed and a selftest was added to trigger that issue again" * tag 'trace-v4.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: x86/ftrace: Make sure that ftrace trampolines are not RWX x86/mm/ftrace: Do not bug in early boot on irqs_disabled in cpu_flush_range() selftests/ftrace: Add a testcase for many kprobe events kprobes/x86: Fix to set RWX bits correctly before releasing trampoline ftrace: Fix memory leak in ftrace_graph_release()
2017-05-26selftests/ftrace: Add a testcase for many kprobe eventsMasami Hiramatsu1-0/+21
Add a testcase to test kprobes via ftrace interface with many concurrent kprobe events. This tries to add many kprobe events (up to 256) on kernel functions. To avoid making ftrace-based kprobes (kprobes on fentry), it skips first N bytes (on x86 N=5, on ppc or arm N=4) of function entry. After that, it enables all those events, disable it, and remove it. Since the unoptimization buffer reclaiming will be delayed, after removing events, it will wait enough time. Link: http://lkml.kernel.org/r/149577388470.11702.11832460851769204511.stgit@devbox Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Suggested-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-05-25bpf: add various verifier test casesDaniel Borkmann1-4/+235
This patch adds various verifier test cases: 1) A test case for the pruning issue when tracking alignment is used. 2) Various PTR_TO_MAP_VALUE_OR_NULL tests to make sure pointer arithmetic turns such register into UNKNOWN_VALUE type. 3) Test cases for the special treatment of LD_ABS/LD_IND to make sure verifier doesn't break calling convention here. Latter is needed, since f.e. arm64 JIT uses r1 - r5 for storing temporary data, so they really must be marked as NOT_INIT. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-05-20Merge tag 'trace-v4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-traceLinus Torvalds4-6/+10
Pull tracing fixes from Steven Rostedt: - Fix a bug caused by not cleaning up the new instance unique triggers when deleting an instance. It also creates a selftest that triggers that bug. - Fix the delayed optimization happening after kprobes boot up self tests being removed by freeing of init memory. - Comment kprobes on why the delay optimization is not a problem for removal of modules, to keep other developers from searching that riddle. - Fix another case of rcu not watching in stack trace tracing. * tag 'trace-v4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing: Make sure RCU is watching before calling a stack trace kprobes: Document how optimized kprobes are removed from module unload selftests/ftrace: Add test to remove instance with active event triggers selftests/ftrace: Fix bashisms ftrace: Remove #ifdef from code and add clear_ftrace_function_probes() stub ftrace/instances: Clear function triggers when removing instances ftrace: Simplify glob handling in unregister_ftrace_function_probe_func() tracing/kprobes: Enforce kprobes teardown after testing tracing: Move postpone selftests to core from early_initcall
2017-05-19Merge tag 'powerpc-4.12-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linuxLinus Torvalds3-1/+122
Pull powerpc fixes from Michael Ellerman: "The headliner is a fix for FP/VMX register corruption when using transactional memory, and a new selftest to go with it. Then there's the virt_addr_valid() fix, currently HARDENDED_USERCOPY is tripping on that causing some machines to crash. A few other fairly minor fixes for long tail things, and a couple of fixes for code we just merged. Thanks to: Breno Leitao, Gautham Shenoy, Michael Neuling, Naveen Rao. Nicholas Piggin, Paul Mackerras" * tag 'powerpc-4.12-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/mm: Fix virt_addr_valid() etc. on 64-bit hash powerpc/mm: Fix crash in page table dump with huge pages powerpc/kprobes: Fix handling of instruction emulation on probe re-entry powerpc/powernv: Set NAPSTATELOST after recovering paca on P9 DD1 selftests/powerpc: Test TM and VMX register state powerpc/tm: Fix FP and VMX register corruption powerpc/modules: If mprofile-kernel is enabled add it to vermagic
2017-05-19selftests/powerpc: Fix TM resched DSCR test with some compilersMichael Ellerman1-1/+1
The tm-resched-dscr test has started failing sometimes, depending on what compiler it's built with, eg: test: tm_resched_dscr Check DSCR TM context switch: tm-resched-dscr: tm-resched-dscr.c:76: test_body: Assertion `rv' failed. !! child died by signal 6 When it fails we see that the compiler doesn't initialise rv to 1 before entering the inline asm block. Although that's counter intuitive, it is allowed because we tell the compiler that the inline asm will write to rv (using "=r"), meaning the original value is irrelevant. Marking it as a read/write parameter would presumably work, but it seems simpler to fix it by setting the initial value of rv in the inline asm. Fixes: 96d016108640 ("powerpc: Correct DSCR during TM context switch") Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Acked-by: Michael Neuling <mikey@neuling.org>
2017-05-17selftests/ftrace: Add test to remove instance with active event triggersNaveen N. Rao1-2/+6
Add a test to ensure we clean up properly when removing an instance with active event triggers. Link: http://lkml.kernel.org/r/c479465b2009397708d6c52c8561e1523c22cd31.1494956770.git.naveen.n.rao@linux.vnet.ibm.com Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>