diff options
| author | Mark Rutland <[email protected]> | 2016-10-11 13:51:27 -0700 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2016-10-11 15:06:30 -0700 |
| commit | bf90e56e467ed5766722972d483e6711889ed1b0 (patch) | |
| tree | 247ecdbbc0e47c0a323e66f523b166c2b5323f24 /tools/perf/scripts/python/bin | |
| parent | e0176a2f1e131294824d0e50e719cd12290cf06c (diff) | |
lib: harden strncpy_from_user
The strncpy_from_user() accessor is effectively a copy_from_user()
specialised to copy strings, terminating early at a NUL byte if possible.
In other respects it is identical, and can be used to copy an arbitrarily
large buffer from userspace into the kernel. Conceptually, it exposes a
similar attack surface.
As with copy_from_user(), we check the destination range when the kernel
is built with KASAN, but unlike copy_from_user() we do not check the
destination buffer when using HARDENED_USERCOPY. As strncpy_from_user()
calls get_user() in a loop, we must call check_object_size() explicitly.
This patch adds this instrumentation to strncpy_from_user(), per the same
rationale as with the regular copy_from_user(). In the absence of
hardened usercopy this will have no impact as the instrumentation expands
to an empty static inline function.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Mark Rutland <[email protected]>
Cc: Kees Cook <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions