summaryrefslogtreecommitdiffstats
path: root/include/linux/slab.h
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2018-01-10 14:48:22 -0800
committerKees Cook <keescook@chromium.org>2018-01-15 12:07:45 -0800
commitf4e6e289cb9cf67885b6b18b9d56d2c3e1c714a1 (patch)
treeef4487691b7cc2581baeebedfa3ef4482ecad3fa /include/linux/slab.h
parentb394d468e7d75637e682a9be4a1181b27186c593 (diff)
downloadlinux-stable-f4e6e289cb9cf67885b6b18b9d56d2c3e1c714a1.tar.gz
linux-stable-f4e6e289cb9cf67885b6b18b9d56d2c3e1c714a1.tar.bz2
linux-stable-f4e6e289cb9cf67885b6b18b9d56d2c3e1c714a1.zip
usercopy: Include offset in hardened usercopy report
This refactors the hardened usercopy code so that failure reporting can happen within the checking functions instead of at the top level. This simplifies the return value handling and allows more details and offsets to be included in the report. Having the offset can be much more helpful in understanding hardened usercopy bugs. Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'include/linux/slab.h')
-rw-r--r--include/linux/slab.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 50697a1d6621..2dbeccdcb76b 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -167,15 +167,11 @@ void kzfree(const void *);
size_t ksize(const void *);
#ifdef CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR
-const char *__check_heap_object(const void *ptr, unsigned long n,
- struct page *page);
+void __check_heap_object(const void *ptr, unsigned long n, struct page *page,
+ bool to_user);
#else
-static inline const char *__check_heap_object(const void *ptr,
- unsigned long n,
- struct page *page)
-{
- return NULL;
-}
+static inline void __check_heap_object(const void *ptr, unsigned long n,
+ struct page *page, bool to_user) { }
#endif
/*