From: Kees Cook <keescook@chromium.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Dan Carpenter <dan.carpenter@oracle.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] uaccess: Disallow > INT_MAX copy sizes
Date: Mon, 23 Sep 2019 16:08:54 -0700 [thread overview]
Message-ID: <201909231607.B6A0736@keescook> (raw)
In-Reply-To: <201908251612.F9902D7A@keescook>
On Sun, Aug 25, 2019 at 04:18:56PM -0700, Kees Cook wrote:
> 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
>
> Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Kees Cook <keescook@chromium.org>
ping! Andrew, can you take this?
-Kees
> ---
> include/linux/thread_info.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
> index 659a4400517b..e93e249a4e9b 100644
> --- a/include/linux/thread_info.h
> +++ b/include/linux/thread_info.h
> @@ -147,6 +147,8 @@ check_copy_size(const void *addr, size_t bytes, bool is_source)
> __bad_copy_to();
> return false;
> }
> + if (WARN_ON_ONCE(bytes > INT_MAX))
> + return false;
> check_object_size(addr, bytes, is_source);
> return true;
> }
> --
> 2.17.1
>
>
> --
> Kees Cook
--
Kees Cook
next prev parent reply other threads:[~2019-09-23 23:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-25 23:18 [PATCH] uaccess: Disallow > INT_MAX copy sizes Kees Cook
2019-09-23 23:08 ` Kees Cook [this message]
2019-09-24 23:29 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201909231607.B6A0736@keescook \
--to=keescook@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=dan.carpenter@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox