Commit graph

73 commits

Author SHA1 Message Date
Shuah Khan
1ede053632 selftests: Makefile: fix for loops in targets to run silently
Fix for loops in targets to run silently to avoid cluttering the test
results.

Suppresses the following from targets: e.g run from breakpoints

for TARGET in breakpoints; do		\
	BUILD_TARGET=$BUILD/$TARGET;	\
	mkdir $BUILD_TARGET  -p;	\
	make OUTPUT=$BUILD_TARGET -C $TARGET;\
done;

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-09-25 10:08:59 -06:00
Shuah Khan
52fd1d0823 selftests: Makefile: clear LDFLAGS for make O=dir use-case
kselftest target fails when object directory is specified to relocate
objects. Inherited "LDFLAGS = -m" fails the test builds. Clear it.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-09-21 07:55:37 -06:00
SeongJae Park
584f34f172 selftests/Makefile: Add missed PHONY targets
`selftests/Makefile` is defining only `install` as entire PHONY target
though there are few more PHONY targets including `run_tests`.  This
commit defines them as the PHONY targets.

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-04-21 11:24:58 -06:00
SeongJae Park
c6a13fafa8 selftests/Makefile: Add missed closing " in comment
A comment for make command usage in `selftets/Makefile` has opening `"`
but no closing `"`.  This commit adds the missed `"` in the comment.

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-04-21 11:21:45 -06:00
Linus Torvalds
0710f3ff91 Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc final vfs updates from Al Viro:
 "A few unrelated patches that got beating in -next.

  Everything else will have to go into the next window ;-/"

* 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  hfs: fix hfs_readdir()
  selftest for default_file_splice_read() infoleak
  9p: constify ->d_name handling
2017-03-03 21:44:35 -08:00
Linus Torvalds
c4f3f22edd linux-kselftest-4.11-rc1
This update consists of:
 
 -- fixes to several existing tests from Stafford Horne
 -- cpufreq tests from Viresh Kumar
 -- Selftest build and install fixes from Bamvor Jian Zhang
    and Michael Ellerman
 -- Fixes to protection-keys tests from Dave Hansen
 -- Warning fixes from Shuah Khan
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABCAAGBQJYsJgxAAoJEAsCRMQNDUMcNCUQALy+jVZV3U1yypLCQinlgbdH
 rlh7oKIpGfWGXNe1BQVLS5S+bjil9XDdty+4VOB7x9gfQ6fvea3w0IQhI5CyONmm
 hZg/miheZzN5ujqKjfuUQrHzEbEAs+CH0A0sVH+ueptw37roTWhf1ZCSpQBpas5p
 XMZrfBI0mQLd9Z3D0G5TSsVjSPcMhKeoYDMGPMCulZuamVMY40XkPcvaYe1Zg1Mj
 7nD7Aw6JxxV0tlZwo0n540w8tdx/yQ+49jqhulozCQNL+KmXO8FlM/Jnu1b24/YW
 hlu5dvLmi9rAHYEHwqFf5yqZci/50Q+LHuxcxEp3RLxRW+KXJP7c53Kn8eutIwqH
 HR03TSA1TRv9b4MvWJs/ULF/EYYtTPUDSinAtNMf4iegXp0BbT7P0eOibF1vj3tz
 bcfPB5vi1SxQqLQwCPomUzhlPB4muBu9lHjZ2tI5EKynXXZxN33zugHYqBY0zNPm
 7dS+4iXs/phEDlW0j+3BhHQz2of+Q6fSOC/jvgAYGdmqh1aNHl9WpIWfFubuBQhd
 fkKJmgpJ1Mk5mBG/dGdCGTryv38tzFLr+n4MJWthfya84cbvk1W0HQQjwmROrIiP
 qxC4F1Da6F88mfrpFDKW9LxAwfJFCgSxnYFygRsyzZK/VKdm2CI8yeoY2rt2lyRF
 jUdxx7SJ7+71sO1xWcAE
 =F3yO
 -----END PGP SIGNATURE-----

Merge tag 'linux-kselftest-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull Kselftest update from Shuah Khan:
 "This update consists of:

   - fixes to several existing tests from Stafford Horne

   - cpufreq tests from Viresh Kumar

   - Selftest build and install fixes from Bamvor Jian Zhang and Michael
     Ellerman

   - Fixes to protection-keys tests from Dave Hansen

   - Warning fixes from Shuah Khan"

* tag 'linux-kselftest-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (28 commits)
  selftests/powerpc: Fix remaining fallout from recent changes
  selftests/powerpc: Fix the clean rule since recent changes
  selftests: Fix the .S and .S -> .o rules
  selftests: Fix the .c linking rule
  selftests: Fix selftests build to just build, not run tests
  selftests, x86, protection_keys: fix wrong offset in siginfo
  selftests, x86, protection_keys: fix uninitialized variable warning
  selftest: cpufreq: Update MAINTAINERS file
  selftest: cpufreq: Add special tests
  selftest: cpufreq: Add support to test cpufreq modules
  selftest: cpufreq: Add suspend/resume/hibernate support
  selftest: cpufreq: Add support for cpufreq tests
  selftests: Add intel_pstate to TARGETS
  selftests/intel_pstate: Update makefile to match new style
  selftests/intel_pstate: Fix warning on loop index overflow
  cpupower: Restore format of frequency-info limit
  selftests/futex: Add headers to makefile dependencies
  selftests/futex: Add stdio used for logging
  selftests: x86 protection_keys remove dead code
  selftests: x86 protection_keys fix unused variable compile warnings
  ...
2017-02-25 15:32:53 -08:00
Al Viro
b8826e506e selftest for default_file_splice_read() infoleak
bug fixed in commit b9dc6f65bc ("fix a fencepost error in pipe_advance()")

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-02-18 22:07:24 -05:00
Viresh Kumar
e66d5b6737 selftest: cpufreq: Add support for cpufreq tests
This patch adds supports for basic cpufreq tests, which can be performed
independent of any platform.

It does basic tests for now, like
- reading all cpufreq files
- trying to update them
- switching frequencies
- switching governors

This can be extended to have more specific tests later on.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-01-19 10:32:05 -07:00
Stafford Horne
6320303fb2 selftests: Add intel_pstate to TARGETS
This test was missing from the TARGETS list.  The test requires patches
to cpupower to pass correctly.

Cc: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Stafford Horne <shorne@gmail.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-01-19 10:30:46 -07:00
bamvor.zhangjian@huawei.com
a8ba798bc8 selftests: enable O and KBUILD_OUTPUT
Enable O and KBUILD_OUTPUT for kselftest. User could compile kselftest
to another directory by passing O or KBUILD_OUTPUT. And O is high
priority than KBUILD_OUTPUT.

Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-01-05 13:42:22 -07:00
Rolf Eike Beer
a2b1e8a20c selftests: do not require bash for the generated test
Nothing in this minimal script seems to require bash. We often run these
tests on embedded devices where the only shell available is the busybox
ash. Use sh instead.

Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Cc: stable@vger.kernel.org
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-01-05 13:18:32 -07:00
Linus Torvalds
09dee2a608 linux-kselftest-4.10-rc1-update
This update consists of:
 
 -- New tests to exercise the Sync Kernel Infrastructure. These tests
    are part of a battery of Android libsync tests and are re-written
    to test the new sync user-space interfaces from Emilio López, and
    Gustavo Padovan.
 
 -- Test to run hw-independent mock tests for i915.ko from Chris Wilson
 
 -- A new gpio test case from Bamvor Jian Zhang
 
 -- Missing gitignore additions
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABCAAGBQJYUv0yAAoJEAsCRMQNDUMcNVQP/0JaO+AaA0GyrxtBlaj4R/sJ
 VI4wQGPIqPGk+DtyjoZ4zkGPZzdY7U05wgJeUrm0/K263XaijjneCvfskCG/2R4d
 1rO0sAOXSsgpDnQ1Nt2hDAV42zSwecFWFl4odfe1oHznME+fKGg7tXHX74/R8FZp
 eMhg0UYME5Dpq4dC3s3NxDYcieHVq9e8v2A5eJx5PjTbcrnztkKzdBiNWUWaW4Jt
 qyUmTVBA2M/vTDyJWCzfTBFadVpYBycewIZdDpQN682VFT6d+mvN/hP6pRYGqNwd
 FDhM1asdhQiJXEmNd7Muufz3CZ5FlzV3VW+u+eZkeEwInw4uwtajXvqM8+5K4YyE
 yKcnCXyFjsmnJtsEba6Gf8S35Dbzcx7j3nJRkqk+ULcGKSUHR2GnWtltZUKtKsqp
 /aB8M1H+xoLKdzDnMADNZG/6YMhGq/QOJn1qocn2HmDUSawjUMriCm2ylo09YQwH
 Ud0WVSTZZD+jWRLAB6nLXOREXLincZ0e7z2wfV/SHQ1d7MaS9lidxSRbwaRLd9+f
 iZ9WS9xkW8axxpe3vmgHdIxxrhy7LLJe+4b/iDo/iMC9waFv6qXcYh7l5/bEXoIz
 0D1eB4L5mBHF032tSatjxy1ewy9uiU5M9STmZVdL6Jla7qsxHQEc0x5cr2evpQ4/
 tjautkTKCbWocEl/KLPt
 =qjL9
 -----END PGP SIGNATURE-----

Merge tag 'linux-kselftest-4.10-rc1-update' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull kselftest updates from Shuah Khan:
 "This update consists of:

   - new tests to exercise the Sync Kernel Infrastructure. These tests
     are part of a battery of Android libsync tests and are re-written
     to test the new sync user-space interfaces from Emilio López, and
     Gustavo Padovan.

   - test to run hw-independent mock tests for i915.ko from Chris Wilson

   - a new gpio test case from Bamvor Jian Zhang

   - missing gitignore additions"

* tag 'linux-kselftest-4.10-rc1-update' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftest/gpio: add gpio test case
  selftest: sync: improve assert() failure message
  kselftests: Exercise hw-independent mock tests for i915.ko
  selftests: add missing gitignore files/dirs
  selftests: add missing set-tz to timers .gitignore
  selftest: sync: stress test for merges
  selftest: sync: stress consumer/producer test
  selftest: sync: stress test for parallelism
  selftest: sync: wait tests for sw_sync framework
  selftest: sync: merge tests for sw_sync framework
  selftest: sync: fence tests for sw_sync framework
  selftest: sync: basic tests for sw_sync framework
2016-12-15 14:17:32 -08:00
Bamvor Jian Zhang
22f6592b23 selftest/gpio: add gpio test case
This test script try to do whitebox testing for gpio subsystem(based on
gpiolib). It manipulate gpio device through chardev or sysfs and check
the result from debugfs. This script test gpio-mockup through chardev by
default. User could test other gpio chip by passing the module name.
Some of the testcases are turned off by default to avoid the conflicting
with gpiochip in system.

In details, it test the following things:
1.  Test direction and output value for valid pin.
2.  Test dynamic allocation of gpio base.
3.  Add single, multi gpiochip to do overlap check.

Run "tools/testing/selftests/gpio/gpio-mockup.sh -h" for usage.

Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2016-12-13 07:26:37 -07:00
Emilio López
82208160ae selftest: sync: basic tests for sw_sync framework
These tests are based on the libsync test suite from Android.
This commit lays the ground for future tests, as well as includes
tests for a variety of basic allocation commands.

Signed-off-by: Emilio López <emilio.lopez@collabora.co.uk>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2016-12-01 18:12:50 -07:00
Daniel Borkmann
5aa5bd14c5 bpf: add initial suite for selftests
Add a start of a test suite for kernel selftests. This moves test_verifier
and test_maps over to tools/testing/selftests/bpf/ along with various
code improvements and also adds a script for invoking test_bpf module.
The test suite can simply be run via selftest framework, f.e.:

  # cd tools/testing/selftests/bpf/
  # make
  # make run_tests

Both test_verifier and test_maps were kind of misplaced in samples/bpf/
directory and we were looking into adding them to selftests for a while
now, so it can be picked up by kbuild bot et al and hopefully also get
more exposure and thus new test case additions.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-18 11:35:55 -04:00
Andrey Vagin
6ad92bf63e tools/testing: add a test to check nsfs ioctl-s
There are two new ioctl-s:
One ioctl for the user namespace that owns a file descriptor.
One ioctl for the parent namespace of a namespace file descriptor.

The test checks that these ioctl-s works and that they handle a case
when a target namespace is outside of the current process namespace.

Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2016-09-22 19:59:41 -05:00
Stas Sergeev
19fd2868e3 selftests/sigaltstack: Add new testcase for sigaltstack(SS_ONSTACK|SS_AUTODISARM)
This patch adds the test case for SS_AUTODISARM flag.
The test-case tries to set SS_AUTODISARM flag and checks if
the nested signal corrupts the stack after swapcontext().

Signed-off-by: Stas Sergeev <stsp@list.ru>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-api@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1460665206-13646-5-git-send-email-stsp@list.ru
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-05-03 08:37:59 +02:00
Bamvor Jian Zhang
7e72247381 selftest/ipc: actually test it
The ipc testcase exist in selftest but no in the TARGETS list.
Add it to the TARGETS.

Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-11-23 13:21:15 -07:00
Bamvor Jian Zhang
f4ecb322ab selftests/capabilities: actually test it
The capatabilities exist in selftest but no in the TARGETS list.
Add it to the TARGETS.

Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-11-23 13:21:02 -07:00
Linus Torvalds
6a177af775 linux-kselftest-4.4-rc1
This 12 patch update for 4.4-rc1 consists of a new pstore
 test and fixes to existing tests.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWQMxXAAoJEAsCRMQNDUMcvQAQALUpci62eNC1PSiDV0qWQxPu
 L6WyQ/ccdzIvR5IGfLb9t/S8+0LHIro5JVgVwiUzjaPiEULWXNhu1zMzZLdxbN5L
 SwgIj+48dGAXfmwdHimRgAMQJteqW95Sz3vF7LFE+qTACje7a6rNtF0qBgZ9TLRB
 RiU6onK3ACKQzCOArWiHetupliTDdffIPdqth0Tod8q82uf/Jf03gxRApx9R7vS2
 FsZrhxjyEKv59cFdSO1Ai/vfYxjdsYQXLocDXTxaOVv3FMT8XBeo9GNPX9GC1LhO
 V4nv86g3UnOgXPBHthx4dDaVc/781BofUk108ZoeBdEQ9oWdW8rElfqdfUmsb0PY
 1tS1sOvBPa3ECt73kbm+xHaorZ+LQT5j8Q28AxKVXgbtdHlEsE50fdxoJS5Tfkwh
 q1N6Ri/MWSxkDgXcL6RtInaO73mDFQ2BBaa9TDP7QVLNl/imyAIsP84P6Z4lm02B
 tZJEGbZiJ60r3Fhbp6Tktw86CC8c3wuN4cOaO6SoIuSzi7XAXuOhb5js0vdXBHRr
 njI4gzm3oNMcpTII5ZX1++0fRqwuGainCaGXa4igvXuE1WxIOiDCMXYqmF/mr4Av
 4b8EU922DferWVg224vhErE5rDFwxVE7FGPwr07M09/Ch+ht3CDkiOz5Lh4kTPYK
 oOi3E+k18mTyNA/Z3IAW
 =MM4D
 -----END PGP SIGNATURE-----

Merge tag 'linux-kselftest-4.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull kselftest updates from Shuah Khan:
 "This 12 patch update for 4.4-rc1 consists of a new pstore test and
  fixes to existing tests"

* tag 'linux-kselftest-4.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftests: breakpoint: Actually build it
  selftests: vm: Try harder to allocate huge pages
  selftests: Make scripts executable
  selftests: kprobe: Choose an always-defined function to probe
  selftests: memfd: Stop unnecessary rebuilds
  selftests: Add missing #include directives
  selftests/seccomp: Be more precise with syscall arguments.
  selftests/seccomp: build and pass on arm64
  selftests: memfd_test: Revised STACK_SIZE to make it 16-byte aligned
  selftests/pstore: add pstore test scripts going with reboot
  selftests/pstore: add pstore test script for pre-reboot
  selftests: add .gitignore for efivarfs
2015-11-10 20:46:45 -08:00
Kees Cook
317dc34ab7 selftests: run lib/test_printf module
This runs the lib/test_printf module to make sure printf is operating
sanely.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-06 17:50:42 -08:00
Hiraku Toyooka
f615e2bb13 selftests/pstore: add pstore test scripts going with reboot
To test pstore in earnest, we have to cause kernel crash and check
pstore filesystem after reboot.

We add two scripts:
 - pstore_crash_test
     This script causes kernel crash and reboot. It is executed by
     'make run_pstore_crash' in selftests. It can also be used with kdump.
 - pstore_post_reboot_tests
     This script includes test cases which check pstore's behavior after
     crash and reboot. It is executed together with pstore_tests by
     'make run_tests [-C pstore]' in selftests.

The test cases in pstore_post_reboot_tests are currently following.

- Check pstore backend is registered
- Mount pstore filesystem
- Check dmesg/console/pmsg files exist in pstore filesystem
- Check dmesg/console files contain oops end marker
- Check pmsg file properly keeps the content written before crash
- Remove all files in pstore filesystem

Example usage is following.

  (before reboot)
  # cd /path/to/selftests
  # make run_tests -C pstore
  === Pstore unit tests (pstore_tests) ===
  UUID=b49b02cf-b0c2-4309-be43-b08c3971e37f
  ...
  selftests: pstore_tests [PASS]
  === Pstore unit tests (pstore_post_reboot_tests) ===
  UUID=953eb1bc-8e03-48d7-b27a-6552b24c5b7e
  Checking pstore backend is registered ... ok
          backend=ramoops
          cmdline=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=768M ramoops.mem_address=0x30000000 ramoops.mem_size=0x10000
  pstore_crash_test has not been executed yet. we skip further tests.
  selftests: pstore_post_reboot_tests [PASS]

  # make run_pstore_crash
  === Pstore unit tests (pstore_crash_test) ===
  UUID=93c8972d-1466-430b-8c4a-28d8681e74c6
  Checking pstore backend is registered ... ok
          backend=ramoops
          cmdline=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=768M ramoops.mem_address=0x30000000 ramoops.mem_size=0x10000
  Causing kernel crash ...
  (kernel crash and reboot)
  ...

  (after reboot)
  # make run_tests -C pstore
  === Pstore unit tests (pstore_tests) ===
  UUID=8e511e77-2285-499f-8bc0-900d9af1fbcc
  ...
  selftests: pstore_tests [PASS]
  === Pstore unit tests (pstore_post_reboot_tests) ===
  UUID=2dcc2132-4f3c-45aa-a38f-3b54bff8cef1
  Checking pstore backend is registered ... ok
          backend=ramoops
          cmdline=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=768M ramoops.mem_address=0x30000000 ramoops.mem_size=0x10000
  Mounting pstore filesystem ... ok
  Checking dmesg files exist in pstore filesystem ... ok
          dmesg-ramoops-0
          dmesg-ramoops-1
  Checking console files exist in pstore filesystem ... ok
          console-ramoops-0
  Checking pmsg files exist in pstore filesystem ... ok
          pmsg-ramoops-0
  Checking dmesg files contain oops end marker
          dmesg-ramoops-0 ... ok
          dmesg-ramoops-1 ... ok
  Checking console file contains oops end marker ... ok
  Checking pmsg file properly keeps the content written before crash ... ok
  Removing all files in pstore filesystem
          console-ramoops-0 ... ok
          dmesg-ramoops-0 ... ok
          dmesg-ramoops-1 ... ok
          pmsg-ramoops-0 ... ok
  selftests: pstore_post_reboot_tests [PASS]

Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mark Salyzyn <salyzyn@android.com>
Cc: Seiji Aguchi <seiji.aguchi.tr@hitachi.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-api@vger.kernel.org
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-10-15 20:00:32 -06:00
Hiraku Toyooka
cc04a46f11 selftests/pstore: add pstore test script for pre-reboot
The pstore_tests script includes test cases which check pstore's
behavior before crash (and reboot).

The test cases are currently following.

- Check pstore backend is registered
- Check pstore console is registered
- Check /dev/pmsg0 exists
- Write unique string to /dev/pmsg0

The unique string written to /dev/pmsg includes UUID. The UUID is also
left in 'uuid' file in order to enable us to check if the pmsg keeps the
string correctly after reboot.

Example usage is following.

  # cd /path/to/selftests
  # make run_tests -C pstore (or just .pstore/pstore_tests)
  make: Entering directory '/path/to/selftests/pstore'
  === Pstore unit tests (pstore_tests) ===
  UUID=b49b02cf-b0c2-4309-be43-b08c3971e37f
  Checking pstore backend is registered ... ok
          backend=ramoops
          cmdline=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=768M ramoops.mem_address=0x30000000 ramoops.mem_size=0x10000
  Checking pstore console is registered ... ok
  Checking /dev/pmsg0 exists ... ok
  Writing unique string to /dev/pmsg0 ... ok
  selftests: pstore_tests [PASS]
  make: Leaving directory '/path/to/selftests/pstore'

We can also see test logs later.

  # cat pstore/logs/20151001-072718_b49b02cf-b0c2-4309-be43-b08c3971e37f/pstore_tests.log
  Thu Oct  1 07:27:18 UTC 2015
  === Pstore unit tests (pstore_tests) ===
  UUID=b49b02cf-b0c2-4309-be43-b08c3971e37f
  Checking pstore backend is registered ... ok
          backend=ramoops
          cmdline=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=768M ramoops.mem_address=0x30000000 ramoops.mem_size=0x10000
  Checking pstore console is registered ... ok
  Checking /dev/pmsg0 exists ... ok
  Writing unique string to /dev/pmsg0 ... ok

Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mark Salyzyn <salyzyn@android.com>
Cc: Seiji Aguchi <seiji.aguchi.tr@hitachi.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-api@vger.kernel.org
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-10-15 20:00:32 -06:00
Bamvor Jian Zhang
1087d01917 selftests: rename jump label to static_keys
Commit 2bf9e0ab08 ("locking/static_keys: Provide a selftest")
renamed jump_label directory to static_keys and failed to update
the Makefile, causing the selftests build to fail.

This commit fixes it by updating the Makefile with the new name
and also moves the entry into the correct position to keep the
list alphabetically sorted.

Fixes: 2bf9e0ab08 ("locking/static_keys: Provide a selftest")
Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-09-14 16:42:23 -06:00
Pranith Kumar
b6d9734416 selftests: add membarrier syscall test
Add a self test for the membarrier system call.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-09-11 15:21:34 -07:00
Linus Torvalds
54283aed90 liux-kselftest-4.3-rc1:
This update adds new zram test and fixes to problems found
 during testing this new zram test. In addition, there are
 a few bug fixes and ksefltest improvement patches from Linaro
 developers.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJV7wEDAAoJEAsCRMQNDUMcH1gQAJFAmc+C7f/8mIqkNjgIHc5g
 /hY6F3Rz8pB6WMO5l9K2gDefhUbu+kHX7QB+hbL9KFRewKj3pmrKeiQa3jvBKaOf
 gw2oH8ObL32ydghLgePAhw+Y66ELwybofbvh9bcY3ABEwj+y6VyMTceVPNJ+L+Rk
 gfacNIPCwJXiJ/d9YncrVZyquULgapSNtJ0KIdYj3//PLbyyFX7MPXKyCiMc0uJW
 2gKdFgs4edUsdY0yAj9bdk5x/wWTzgJKeGaJyANRri1fEaedcBdRvSbO3V0aUCv3
 d4Lbc2IZ/7LDw7+tWcQmtfjwjqdkGhXqJdo5uihqtSRCPVigBZqfhemCNH2tQuc/
 DihU+H3EXRvDXHyT2yyY+RLpSGpelGcnHMJmrXsjDDIpHFGa+6EH/iloZGZJcwDh
 bOu9fSaBgeeOrxgtY8CPp4W0l8h58q9NwXqCe/ZzwAyteC02+cD48qwEnic7azuL
 aw5V93F2ObvPyW/7FkqDIF/XHcvGV4mMTadwq6FZ38h7DnrvhBOEBf1zcskeCR/X
 r+Nq/5nOFZs6Y88G/H0bk9tN7z3gsMCcLolrkRj5OLNVvyQb3IH8PuMdRUeMPDgL
 gOYkq5/mZdXj/UfFRqVv18lzqCIYQxfmnlCxL243TvJFudzSev8X1PJZ2SiGOCYG
 iMvYk4oTxyi9Ugw6hM8K
 =dXt3
 -----END PGP SIGNATURE-----

Merge tag 'linux-kselftest-4.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull kselftest update from Shuah Khan:
 "This update adds new zram test and fixes to problems found during
  testing this new zram test.  In addition, there are a few bug fixes
  and ksefltest improvement patches from Linaro developers.

  I will send another update later on this week to fix kselftest
  breakage due to commit 2bf9e0ab08 ("locking/static_keys: Provide a
  selftest") after the fix soaks in next for a couple of days"

* tag 'linux-kselftest-4.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftests/zram: Makefile fix
  selftests/zram: must be run as root
  selftests: breakpoints: fix installing error on the architecture except x86
  selftests: check before install
  selftests/zram: Adding zram tests
2015-09-08 17:39:10 -07:00
Bamvor Jian Zhang
a7d0f07889 selftests: check before install
When the test cases is not supported by the current architecture
the install files(TEST_PROGS, TEST_PROGS_EXTENDED and TEST_FILES)
will be empty. Check it before installation to dismiss a failure
reported by install program.

Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-08-27 16:04:15 -06:00
Naresh Kamboju
f21fb798fe selftests/zram: Adding zram tests
zram: Compressed RAM based block devices
----------------------------------------
The zram module creates RAM based block devices named /dev/zram<id>
(<id> = 0, 1, ...). Pages written to these disks are compressed and stored
in memory itself. These disks allow very fast I/O and compression provides
good amounts of memory savings. Some of the usecases include /tmp storage,
use as swap disks, various caches under /var and maybe many more :)

Statistics for individual zram devices are exported through sysfs nodes at
/sys/block/zram<id>/

This patch is to validate the zram functionality. Test interacts with block
device /dev/zram<id> and sysfs nodes /sys/block/zram<id>/

zram.sh: sanity check of CONFIG_ZRAM and to run zram01 and zram02 tests
zram01.sh: creates general purpose ram disks with different filesystems
zram02.sh: creates block device for swap
zram_lib.sh: create library with initialization/cleanup functions
README: ZRAM introduction and Kconfig required.
Makefile: To run zram tests

zram test output
-----------------
./zram.sh
--------------------
running zram tests
--------------------
/dev/zram0 device file found: OK
set max_comp_streams to zram device(s)
/sys/block/zram0/max_comp_streams = '2' (1/1)
zram max streams: OK
test that we can set compression algorithm
supported algs: [lzo] lz4
/sys/block/zram0/comp_algorithm = 'lzo' (1/1)
zram set compression algorithm: OK
set disk size to zram device(s)
/sys/block/zram0/disksize = '2097152' (1/1)
zram set disksizes: OK
set memory limit to zram device(s)
/sys/block/zram0/mem_limit = '2M' (1/1)
zram set memory limit: OK
make ext4 filesystem on /dev/zram0
zram mkfs.ext4: OK
mount /dev/zram0
zram mount of zram device(s): OK
fill zram0...
zram0 can be filled with '1932' KB
zram used 3M, zram disk sizes 2097152M
zram compression ratio: 699050.66:1: OK
zram cleanup
zram01 : [PASS]

/dev/zram0 device file found: OK
set max_comp_streams to zram device(s)
/sys/block/zram0/max_comp_streams = '2' (1/1)
zram max streams: OK
set disk size to zram device(s)
/sys/block/zram0/disksize = '1048576' (1/1)
zram set disksizes: OK
set memory limit to zram device(s)
/sys/block/zram0/mem_limit = '1M' (1/1)
zram set memory limit: OK
make swap with zram device(s)
done with /dev/zram0
zram making zram mkswap and swapon: OK
zram swapoff: OK
zram cleanup
zram02 : [PASS]

CC: Shuah Khan <shuahkh@osg.samsung.com>
CC: Tyler Baker <tyler.baker@linaro.org>
CC: Milosz Wasilewski <milosz.wasilewski@linaro.org>
CC: Alexey Kodanev <alexey.kodanev@oracle.com>
Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Reviewed-By: Tyler Baker <tyler.baker@linaro.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-08-27 16:02:01 -06:00
Jason Baron
579e1acb15 jump_label: Provide a self-test
Signed-off-by: Jason Baron <jbaron@akamai.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: benh@kernel.crashing.org
Cc: bp@alien8.de
Cc: davem@davemloft.net
Cc: ddaney@caviumnetworks.com
Cc: heiko.carstens@de.ibm.com
Cc: linux-kernel@vger.kernel.org
Cc: liuj97@gmail.com
Cc: luto@amacapital.net
Cc: michael@ellerman.id.au
Cc: rabin@rab.in
Cc: ralf@linux-mips.org
Cc: rostedt@goodmis.org
Cc: shuahkh@osg.samsung.com
Cc: vbabka@suse.cz
Cc: will.deacon@arm.com
Link: http://lkml.kernel.org/r/0c091ecebd78a879ed8a71835d205a691a75ab4e.1438227999.git.jbaron@akamai.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-08-03 11:51:11 +02:00
Shuah Khan
2278e5ed9f selftests: add quicktest support
Add quicktest support to enable users to choose to run
tests that complete in a short time. Choosing this option
excludes tests that take longer time complete e.g: timers.
User can specify quicktest option from kernel top level or
selftests directory.

Kernel top level directory:
make quicktest=1 kselftest

tools/testing/selftests directory:
make quicktest=1 run_tests

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-06-23 07:20:16 -06:00
Kees Cook
c99ee51a9d selftests: add seccomp suite
This imports the existing seccomp test suite into the kernel's selftests
tree. It contains extensive testing of seccomp features and corner cases.
There remain additional tests to move into the kernel tree, but they have
not yet been ported to all the architectures seccomp supports:
https://github.com/redpig/seccomp/tree/master/tests

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-06-17 17:12:32 -06:00
Arnaldo Carvalho de Melo
60df4642a8 tools selftests: Fix 'clean' target with make 3.81
Make 3.81 doesn't have the 'undefine' command. Using undefine
to clear LDFLAGS fails when make version 3.81 is used. Fix it
to use override to clear LDFLAGS.

Tested-by: Shuah Khan <shuahkh@osg.samsung.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Link: http://lkml.kernel.org/r/20150514151225.GH23588@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-05-26 15:58:09 -06:00
Darren Hart
ecac1a7549 selftests: Add futex tests to the top-level Makefile
Enable futex tests to be built and run with the make kselftest and
associated targets.

Most of the tests require escalated privileges. These return ERROR, and
run.sh continues.

Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: linux-api@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-05-26 15:58:08 -06:00
Linus Torvalds
60f898eeaa Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 asm changes from Ingo Molnar:
 "There were lots of changes in this development cycle:

   - over 100 separate cleanups, restructuring changes, speedups and
     fixes in the x86 system call, irq, trap and other entry code, part
     of a heroic effort to deobfuscate a decade old spaghetti asm code
     and its C code dependencies (Denys Vlasenko, Andy Lutomirski)

   - alternatives code fixes and enhancements (Borislav Petkov)

   - simplifications and cleanups to the compat code (Brian Gerst)

   - signal handling fixes and new x86 testcases (Andy Lutomirski)

   - various other fixes and cleanups

  By their nature many of these changes are risky - we tried to test
  them well on many different x86 systems (there are no known
  regressions), and they are split up finely to help bisection - but
  there's still a fair bit of residual risk left so caveat emptor"

* 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (148 commits)
  perf/x86/64: Report regs_user->ax too in get_regs_user()
  perf/x86/64: Simplify regs_user->abi setting code in get_regs_user()
  perf/x86/64: Do report user_regs->cx while we are in syscall, in get_regs_user()
  perf/x86/64: Do not guess user_regs->cs, ss, sp in get_regs_user()
  x86/asm/entry/32: Tidy up JNZ instructions after TESTs
  x86/asm/entry/64: Reduce padding in execve stubs
  x86/asm/entry/64: Remove GET_THREAD_INFO() in ret_from_fork
  x86/asm/entry/64: Simplify jumps in ret_from_fork
  x86/asm/entry/64: Remove a redundant jump
  x86/asm/entry/64: Optimize [v]fork/clone stubs
  x86/asm/entry: Zero EXTRA_REGS for stub32_execve() too
  x86/asm/entry/64: Move stub_x32_execvecloser() to stub_execveat()
  x86/asm/entry/64: Use common code for rt_sigreturn() epilogue
  x86/asm/entry/64: Add forgotten CFI annotation
  x86/asm/entry/irq: Simplify interrupt dispatch table (IDT) layout
  x86/asm/entry/64: Move opportunistic sysret code to syscall code path
  x86, selftests: Add sigreturn selftest
  x86/alternatives: Guard NOPs optimization
  x86/asm/entry: Clear EXTRA_REGS for all executable formats
  x86/signal: Remove pax argument from restore_sigcontext
  ...
2015-04-13 13:16:36 -07:00
Linus Torvalds
4541fec310 linux-kselftest-4.1-rc1
This update adds install and packaging tools developed on top
 of back-end shared logic enhancemnets to run and install tests.
 In addition several timer tests are added.
 
 - New timer tests from John Stultz
 - rtc test from Prarit Bhargava
 - Enhancements to un and install tests from Michael Ellerman
 - Install and packaging tools from Shuah Khan
 - Cross-compilation enablement from Tyler Baker
 - A couple of bug fixes.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVIuw/AAoJEAsCRMQNDUMcO5gP/RlKsICYrG8R26cifiDJn7G0
 loSNuZ7f1oGiXtAw/MjCCUI9bxS9c6Y7z03FsgsztU6BN3xy2N0y1dsy29ix8Vc5
 uOak3Gl9fVg+cVMu6nTuDMMesBXpRCP9Wy+bmS2yBl8iTYETzagjLpMxCXcNbkll
 JSx78+09KE3H7HflCl2mK9HjmIfmZzu5TDCzYgwZHn6BC9atZBpJDNfD+mGDJSBo
 B+UMeR9rGV25axELky5Ul4N9f6Gssw4sEYMLx+UwyRE27kvL4q3jKMpIPgqtmYJh
 T1Ob09XaCEpiUF9eTdWoQWQT3AXVJTExPBmAfMqgv+znoEmx82xccqe8kWmbDiUP
 rcwfCBUYk5fS2UXc1L6fa5aBMtJUaFb9KBhbcTJNWAtMc5YYOOpTiQmEKaE2Rc6n
 5aRf2sEc9T1DG52BKde7Vg9GaAuzHgkomJDJeu4NtYJgoNuDyYnrQcGs13Xe+4DK
 u3hpiu3fz/0Pt+sX9hIMVaUbGwO6TticyEHNtkAdinRSjTcOVg6oYWh1WrWTcOPp
 Z0PH0ysdKF7nPk78uLqaSz9b20IwivyEaLVwczc1OkPoTjsrbm+3IP/oqepmhK+C
 S0+oVL4BWHHSyK6Lls7maXCy0D356GT6AaIKyzpJ2f36QhIjaTVX8RPZ2l6dC6h0
 ieZZQYW4ALd+6qmfzPxe
 =M1zT
 -----END PGP SIGNATURE-----

Merge tag 'linux-kselftest-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull kselftest updates from Shuah Khan:
 "This is a milestone update in a sense.  Several new tests and install
  and packaging support is added in this update.

  This update adds install and packaging tools developed on top of
  back-end shared logic enhancemnets to run and install tests.  In
  addition several timer tests are added.

   - New timer tests from John Stultz

   - rtc test from Prarit Bhargava

   - Enhancements to un and install tests from Michael Ellerman

   - Install and packaging tools from Shuah Khan

   - Cross-compilation enablement from Tyler Baker

   - A couple of bug fixes"

* tag 'linux-kselftest-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (42 commits)
  ftracetest: Do not use usleep directly
  selftest/mqueue: enable cross compilation
  selftest/ipc: enable cross compilation
  selftest/memfd: include default header install path
  selftest/mount: enable cross compilation
  selftest/memfd: enable cross compilation
  kselftests: timers: Make set-timer-lat fail more gracefully for !CAP_WAKE_ALARM
  selftests: Change memory on-off-test.sh name to be unique
  selftests: change cpu on-off-test.sh name to be unique
  selftests/mount: Make git ignore all binaries in mount test suite
  kselftests: timers: Reduce default runtime on inconsistency-check and set-timer-lat
  ftracetest: Convert exit -1 to exit $FAIL
  ftracetest: Cope properly with stack tracer not being enabled
  tools, update rtctest.c to verify passage of time
  Documentation, split up rtc.txt into documentation and test file
  selftests: Add tool to generate kselftest tar archive
  selftests: Add kselftest install tool
  selftests: Set CC using CROSS_COMPILE once in lib.mk
  selftests: Add install support for the powerpc tests
  selftests/timers: Use shared logic to run and install tests
  ...
2015-04-13 08:59:21 -07:00
Ingo Molnar
4bcc7827b0 Linux 4.0-rc7
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJVIws/AAoJEHm+PkMAQRiGwEcH/1GCBqrBzXaKwDdCPMRcYVUb
 MYkXmGkCGRYWe5MXI8QNAaa/CdG6mAFMHWN6CaMMpLTxnM1m87uBg01fQMsh73BO
 mRVLKE/soiJDnR1gYzBBDBYV/AUvytN5PhgeNaA95YIJvU3T1f3iTnV8vs30Dp0L
 YpxSqwr3C0k7C9IE0VcgfzvWJPCnQ9IWHuX3jn5s1XjGKVNbBYHMt6FusHdyXMfT
 dp8ksuGHwm30mTFI5xJpKOrRzfi+P5EsEUrsnFRPRM/iFTVrM5R7eaUhsRZb2+Wo
 YApnbYhUYz7om1AuQ+UZ/+S6y7ZLlGWegI1lWI754GIsczG5vPHEYhhgkzMhTsc=
 =kR1V
 -----END PGP SIGNATURE-----

Merge tag 'v4.0-rc7' into x86/asm, to resolve conflicts

Conflicts:
	arch/x86/kernel/entry_64.S

Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-04-08 09:01:54 +02:00
Andy Lutomirski
3f705dfdf8 x86, selftests: Add sigreturn selftest
This is my sigreturn test, added mostly unchanged from its old
home. It exercises the sigreturn(2) syscall, specifically
focusing on its interactions with various IRET corner cases.

It tests for correct behavior in several areas that were
historically dangerously buggy. For example, it exercises espfix
on kernels of both bitnesses under various conditions, and it
contains testcases for several now-fixed bugs in IRET error
handling.

If you run it on older kernels without the fixes, your system will
crash. It probably won't eat your data in the process.

There is no released kernel on which the sigreturn_64 test will
pass, but it passes on tip:x86/asm.

I plan to switch to lib.mk for Linux 4.2.

I'm not using the ksft_ helpers at all yet.  I can do that later.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Shuah Khan <shuah.kh@samsung.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/89d10b76b92c7202d8123654dc8d36701c017b3d.1428386971.git.luto@kernel.org
[ Fixed empty format string GCC build warning in trivial_32bit_program.c ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-04-08 08:22:02 +02:00
Shuah Khan
67d8712dcc selftests: Fix build failures when invoked from kselftest target
Several tests that rely on implicit build rules fail to build,
when invoked from the main Makefile kselftest target. These
failures are due to --no-builtin-rules and --no-builtin-variables
options set in the inherited MAKEFLAGS.

--no-builtin-rules eliminates the use of built-in implicit rules
and --no-builtin-variables is for not defining built-in variables.
These two options override the use of implicit rules resulting in
build failures. In addition, inherited LDFLAGS result in build
failures and there is no need to define LDFLAGS.  Clear LDFLAGS
and MAKEFLAG when make is invoked from the main Makefile kselftest
target. Fixing this at selftests Makefile avoids changing the main
Makefile and keeps this change self contained at selftests level.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
2015-03-19 09:54:55 -06:00
Michael Ellerman
32dcfba6f8 selftests: Add install target
This adds make install support to selftests. The basic usage is:

$ cd tools/testing/selftests
$ make install

That installs into tools/testing/selftests/install, which can then be
copied where ever necessary.

The install destination is also configurable using eg:

$ INSTALL_PATH=/mnt/selftests make install

The implementation uses two targets in the child makefiles. The first
"install" is expected to install all files into $(INSTALL_PATH).

The second, "emit_tests", is expected to emit the test instructions (ie.
bash script) on stdout. Separating this from install means the child
makefiles need no knowledge of the location of the test script.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-03-13 15:21:56 -06:00
Andrew Morton
96e869d857 tools/testing/selftests/Makefile: alphasort the TARGETS list
This list is supposed to be sorted, to reduce patch collisions.

Cc: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-18 19:08:11 -08:00
Linus Torvalds
61de8e5364 kselftest updates for 3.19-rc1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJUj0wTAAoJEAsCRMQNDUMc/jEQAIcMbtui9jj2B7gfgYpRHX/7
 osfaYgjm2aMc0ccC8hn2WVotnhR2tcg3nOaYRf8/VssNhcQYoAReN2+nHp0LZ/kl
 A8gdh7xq79asM9fZ8pkrvqyyeyBXAZsfQnwOfu1iDa6h0GGGzz7MJZ+f2ky1bPJs
 zf4P2JTpr5jh6lflU1mY+STXOcFojHfy5wr9zgGpGUGxXihiUyVjv31+HbZaVoRV
 7khTuIMPIIkyVXQKTJSJpqZkShoKj6DVResIjEai9oH2LM1WbXVDqitgsEdyErOG
 jm9aF0FRdQm3chXN5KKgOvIcatdhP+kypis/3zSb7zO0aAtIVkNo4PSEaYoC9Huz
 BfFKJbm+j+3alEb/51R0XCcj04qcjhhbx+vhEQpucGb1dnT9C9kRSCYDZH/o0+YZ
 ozgGaiH4IGxoZraxL2QuwxDs5/x8QzAOg/p/bgztgIVkjvjLk8G8+wTo21946vGr
 lpE/fz3DILxL1mQNPjohjFm/FSXb94fQGWb4RQ34x/sJJgus7bz7ftzaeVNqBSbU
 PILJG2QuwT1xxEV44eXTCQycQTZQ/v8o2R0QzjzqR5hU7Oz6d86Rt+ijNO+JFWuA
 kFCm1EdhSirzZ5R2V3IjQKJGhwXZMs4+BINA14FP9zik1xYSH2Sx+o2fWJ335rzm
 geA73v1btvT1xQ0mrI+K
 =DL3K
 -----END PGP SIGNATURE-----

Merge tag 'linux-kselftest-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull kselftest update from Shuah Khan:
 "kselftest updates for 3.19-rc1:

   - kcmp test include file cleanup
   - kcmp change to build on all architectures
   - A light weight kselftest framework that provides a set of
     interfaces for tests to use to report results.  In addition,
     several tests are updated to use the framework.
   - A new runtime system size test that prints the amount of RAM that
     the currently running system is using"

* tag 'linux-kselftest-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftest: size: Add size test for Linux kernel
  selftests/kcmp: Always try to build the test
  selftests/kcmp: Don't include kernel headers
  kcmp: Move kcmp.h into uapi
  selftests/timers: change test to use ksft framework
  selftests/kcmp: change test to use ksft framework
  selftests/ipc: change test to use ksft framework
  selftests/breakpoints: change test to use ksft framework
  selftests: add kselftest framework for uniform test reporting
  selftests/user: move test out of Makefile into a shell script
  selftests/net: move test out of Makefile into a shell script
2014-12-16 13:15:12 -08:00
David Drysdale
c9b26b81af syscalls: add selftest for execveat(2)
Signed-off-by: David Drysdale <drysdale@google.com>
Cc: Meredydd Luff <meredydd@senatehouse.org>
Cc: Shuah Khan <shuah.kh@samsung.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Rich Felker <dalias@aerifal.cx>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-13 12:42:51 -08:00
Tim Bird
3ce51050fa selftest: size: Add size test for Linux kernel
This test shows the amount of memory used by the system.
Note that this is dependent on the user-space that is loaded
when this program runs.  Optimally, this program would be
run as the init program itself.

The program is optimized for size itself, to avoid conflating
its own execution with that of the system software.
The code is compiled statically, with no stdlibs. On my x86_64 system,
this results in a statically linked binary of less than 5K.

Signed-off-by: Tim Bird <tim.bird@sonymobile.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2014-12-03 19:27:47 -07:00
Masami Hiramatsu
6e68e6c5e4 ftracetest: Initial commit for ftracetest
ftracetest is a collection of testcase shell-scripts for ftrace.
To avoid regressions of ftrace, these testcases check correct
ftrace behaviors. If someone would like to add any features on
ftrace, the patch series should have at least one testcase for
checking the new behavior.

Link: http://lkml.kernel.org/p/20140922234250.23415.68758.stgit@kbuild-f20.novalocal

Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2014-09-23 09:31:05 -04:00
Linus Torvalds
77e40aae76 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
Pull namespace updates from Eric Biederman:
 "This is a bunch of small changes built against 3.16-rc6.  The most
  significant change for users is the first patch which makes setns
  drmatically faster by removing unneded rcu handling.

  The next chunk of changes are so that "mount -o remount,.." will not
  allow the user namespace root to drop flags on a mount set by the
  system wide root.  Aks this forces read-only mounts to stay read-only,
  no-dev mounts to stay no-dev, no-suid mounts to stay no-suid, no-exec
  mounts to stay no exec and it prevents unprivileged users from messing
  with a mounts atime settings.  I have included my test case as the
  last patch in this series so people performing backports can verify
  this change works correctly.

  The next change fixes a bug in NFS that was discovered while auditing
  nsproxy users for the first optimization.  Today you can oops the
  kernel by reading /proc/fs/nfsfs/{servers,volumes} if you are clever
  with pid namespaces.  I rebased and fixed the build of the
  !CONFIG_NFS_FS case yesterday when a build bot caught my typo.  Given
  that no one to my knowledge bases anything on my tree fixing the typo
  in place seems more responsible that requiring a typo-fix to be
  backported as well.

  The last change is a small semantic cleanup introducing
  /proc/thread-self and pointing /proc/mounts and /proc/net at it.  This
  prevents several kinds of problemantic corner cases.  It is a
  user-visible change so it has a minute chance of causing regressions
  so the change to /proc/mounts and /proc/net are individual one line
  commits that can be trivially reverted.  Unfortunately I lost and
  could not find the email of the original reporter so he is not
  credited.  From at least one perspective this change to /proc/net is a
  refgression fix to allow pthread /proc/net uses that were broken by
  the introduction of the network namespace"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
  proc: Point /proc/mounts at /proc/thread-self/mounts instead of /proc/self/mounts
  proc: Point /proc/net at /proc/thread-self/net instead of /proc/self/net
  proc: Implement /proc/thread-self to point at the directory of the current thread
  proc: Have net show up under /proc/<tgid>/task/<tid>
  NFS: Fix /proc/fs/nfsfs/servers and /proc/fs/nfsfs/volumes
  mnt: Add tests for unprivileged remount cases that have found to be faulty
  mnt: Change the default remount atime from relatime to the existing value
  mnt: Correct permission checks in do_remount
  mnt: Move the test for MNT_LOCK_READONLY from change_mount_flags into do_remount
  mnt: Only change user settable mount flags in remount
  namespaces: Use task_lock and not rcu to protect nsproxy
2014-08-09 17:10:41 -07:00
David Herrmann
4f5ce5e8d7 selftests: add memfd_create() + sealing tests
Some basic tests to verify sealing on memfds works as expected and
guarantees the advertised semantics.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Hugh Dickins <hughd@google.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Ryan Lortie <desrt@desrt.ca>
Cc: Lennart Poettering <lennart@poettering.net>
Cc: Daniel Mack <zonque@gmail.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-08-08 15:57:31 -07:00
Linus Torvalds
29b88e23a9 Driver core patches for 3.17-rc1
Here's the big driver-core pull request for 3.17-rc1.
 
 Largest thing in here is the dma-buf rework and fence code, that touched
 many different subsystems so it was agreed it should go through this
 tree to handle merge issues.  There's also some firmware loading
 updates, as well as tests added, and a few other tiny changes, the
 changelog has the details.
 
 All have been in linux-next for a long time.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlPf1XcACgkQMUfUDdst+ylREACdHLXBa02yLrRzbrONJ+nARuFv
 JuQAoMN49PD8K9iMQpXqKBvZBsu+iCIY
 =w8OJ
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core updates from Greg KH:
 "Here's the big driver-core pull request for 3.17-rc1.

  Largest thing in here is the dma-buf rework and fence code, that
  touched many different subsystems so it was agreed it should go
  through this tree to handle merge issues.  There's also some firmware
  loading updates, as well as tests added, and a few other tiny changes,
  the changelog has the details.

  All have been in linux-next for a long time"

* tag 'driver-core-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (32 commits)
  ARM: imx: Remove references to platform_bus in mxc code
  firmware loader: Fix _request_firmware_load() return val for fw load abort
  platform: Remove most references to platform_bus device
  test: add firmware_class loader test
  doc: fix minor typos in firmware_class README
  staging: android: Cleanup style issues
  Documentation: devres: Sort managed interfaces
  Documentation: devres: Add devm_kmalloc() et al
  fs: debugfs: remove trailing whitespace
  kernfs: kernel-doc warning fix
  debugfs: Fix corrupted loop in debugfs_remove_recursive
  stable_kernel_rules: Add pointer to netdev-FAQ for network patches
  driver core: platform: add device binding path 'driver_override'
  driver core/platform: remove unused implicit padding in platform_object
  firmware loader: inform direct failure when udev loader is disabled
  firmware: replace ALIGN(PAGE_SIZE) by PAGE_ALIGN
  firmware: read firmware size using i_size_read()
  firmware loader: allow disabling of udev as firmware loader
  reservation: add suppport for read-only access using rcu
  reservation: update api and add some helpers
  ...

Conflicts:
	drivers/base/platform.c
2014-08-04 18:34:04 -07:00
Eric W. Biederman
db181ce011 mnt: Add tests for unprivileged remount cases that have found to be faulty
Kenton Varda <kenton@sandstorm.io> discovered that by remounting a
read-only bind mount read-only in a user namespace the
MNT_LOCK_READONLY bit would be cleared, allowing an unprivileged user
to the remount a read-only mount read-write.

Upon review of the code in remount it was discovered that the code allowed
nosuid, noexec, and nodev to be cleared.  It was also discovered that
the code was allowing the per mount atime flags to be changed.

The first naive patch to fix these issues contained the flaw that using
default atime settings when remounting a filesystem could be disallowed.

To avoid this problems in the future add tests to ensure unprivileged
remounts are succeeding and failing at the appropriate times.

Cc: stable@vger.kernel.org
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2014-07-31 17:13:15 -07:00
Kees Cook
0a8adf5847 test: add firmware_class loader test
This provides a simple interface to trigger the firmware_class loader
to test built-in, filesystem, and user helper modes. Additionally adds
tests via the new interface to the selftests tree.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17 18:44:19 -07:00
Shuah Khan
ddddda9bc4 tools: selftests - create a separate hotplug target for full range test
On some systems, hot-plug tests could hang forever waiting for cpu and
memory to be ready to be offlined. A special hot-plug target is created
to run full range of hot-plug tests. In default mode, hot-plug tests run
in safe mode with a limited scope. In limited mode, cpu-hotplug test is
run on a single cpu as opposed to all hotplug capable cpus, and memory
hotplug test is run on 2% of hotplug capable memory instead of 10%. In
addition to the above change, cpu-hotplug is chnged to change processor
affinity to cpu 0 so it doesn't impact itself while the test runs.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Michael Ellerman <michael@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-11 18:13:06 -07:00