diff options
author | Kees Cook <keescook@chromium.org> | 2014-01-23 18:54:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-23 19:36:57 -0500 |
commit | 3e2a4c183ace8708c69f589505fb82bb63010ade (patch) | |
tree | e201c3d60f39bbe3ba5026417d454553ad2fe073 /tools/testing | |
parent | 93e9ef83f40603535ffe6b60498149e75f33aa8f (diff) |
test: check copy_to/from_user boundary validation
To help avoid an architecture failing to correctly check kernel/user
boundaries when handling copy_to_user, copy_from_user, put_user, or
get_user, perform some simple tests and fail to load if any of them
behave unexpectedly.
Specifically, this is to make sure there is a way to notice if things
like what was fixed in commit 8404663f81d2 ("ARM: 7527/1: uaccess:
explicitly check __user pointer when !CPU_USE_DOMAINS") ever regresses
again, for any architecture.
Additionally, adds new "user" selftest target, which loads this module.
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'tools/testing')
-rw-r--r-- | tools/testing/selftests/Makefile | 1 | ||||
-rw-r--r-- | tools/testing/selftests/user/Makefile | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 9f3eae290900..32487ed18354 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile | |||
@@ -9,6 +9,7 @@ TARGETS += ptrace | |||
9 | TARGETS += timers | 9 | TARGETS += timers |
10 | TARGETS += vm | 10 | TARGETS += vm |
11 | TARGETS += powerpc | 11 | TARGETS += powerpc |
12 | TARGETS += user | ||
12 | 13 | ||
13 | all: | 14 | all: |
14 | for TARGET in $(TARGETS); do \ | 15 | for TARGET in $(TARGETS); do \ |
diff --git a/tools/testing/selftests/user/Makefile b/tools/testing/selftests/user/Makefile new file mode 100644 index 000000000000..396255bd720e --- /dev/null +++ b/tools/testing/selftests/user/Makefile | |||
@@ -0,0 +1,13 @@ | |||
1 | # Makefile for user memory selftests | ||
2 | |||
3 | # No binaries, but make sure arg-less "make" doesn't trigger "run_tests" | ||
4 | all: | ||
5 | |||
6 | run_tests: all | ||
7 | @if /sbin/modprobe test_user_copy ; then \ | ||
8 | rmmod test_user_copy; \ | ||
9 | echo "user_copy: ok"; \ | ||
10 | else \ | ||
11 | echo "user_copy: [FAIL]"; \ | ||
12 | exit 1; \ | ||
13 | fi | ||