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 8404663f ("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>
Showing
- lib/Kconfig.debug 13 additions, 0 deletionslib/Kconfig.debug
- lib/Makefile 1 addition, 0 deletionslib/Makefile
- lib/test_user_copy.c 110 additions, 0 deletionslib/test_user_copy.c
- tools/testing/selftests/Makefile 1 addition, 0 deletionstools/testing/selftests/Makefile
- tools/testing/selftests/user/Makefile 13 additions, 0 deletionstools/testing/selftests/user/Makefile
Loading
Please register or sign in to comment