lkml.org 
[lkml]   [2013]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] test: check copy_to/from_user boundary validation
On Tue,  3 Dec 2013 13:27:34 -0800 Kees Cook <keescook@chromium.org> wrote:

> 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 8404663f81d212918ff85f493649a7991209fa04 ("ARM:
> 7527/1: uaccess: explicitly check __user pointer when !CPU_USE_DOMAINS")
> ever regresses again, for any architecture.

I guess the challenge will be to get anyone to remember to run this.

Really, this could be viewed as a candidate for
tools/testing/selftests. The tests in there are userspace tests, and
your userspace test would consist of "modprobe test_user_copy". The
advantage of this is that your test will get included whenever someone
runs the selftest suite. This is better than having it stranded over
in ./kernel/.

> ---
> kernel/Makefile | 1 +
> kernel/test_user_copy.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++
> lib/Kconfig.debug | 13 ++++++

We already have a whole pile of test modules - seven of them reside in
lib/ and I think there's an RCU one somewhere. Can we bring order to
all of this? Some form of integration under tools/testing would be one
approach.

If you're disinclined to undertake such a project at this time, I'd
suggest these two go into lib/ so they are known about if/when someone
goes for the big cleanup.



\
 
 \ /
  Last update: 2013-12-03 23:01    [W:0.050 / U:1.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site