The patch titled Subject: uaccess: disallow > INT_MAX copy sizes has been added to the -mm tree. Its filename is uaccess-disallow-int_max-copy-sizes.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/uaccess-disallow-int_max-copy-sizes.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/uaccess-disallow-int_max-copy-sizes.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Kees Cook <keescook@xxxxxxxxxxxx> Subject: uaccess: disallow > INT_MAX copy sizes As we've done with VFS, string operations, etc, reject usercopy sizes larger than INT_MAX, which would be nice to have for catching bugs related to size calculation overflows[1]. This adds 10 bytes to x86_64 defconfig text and 1980 bytes to the data section: text data bss dec hex filename 19691167 5134320 1646664 26472151 193eed7 vmlinux.before 19691177 5136300 1646664 26474141 193f69d vmlinux.after [1] https://marc.info/?l=linux-s390&m=156631939010493&w=2 Link: http://lkml.kernel.org/r/201908251612.F9902D7A@keescook Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx> Suggested-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/thread_info.h | 2 ++ 1 file changed, 2 insertions(+) --- a/include/linux/thread_info.h~uaccess-disallow-int_max-copy-sizes +++ a/include/linux/thread_info.h @@ -147,6 +147,8 @@ check_copy_size(const void *addr, size_t __bad_copy_to(); return false; } + if (WARN_ON_ONCE(bytes > INT_MAX)) + return false; check_object_size(addr, bytes, is_source); return true; } _ Patches currently in -mm which might be from keescook@xxxxxxxxxxxx are uaccess-disallow-int_max-copy-sizes.patch