All of lore.kernel.org
 help / color / mirror / Atom feed
From: heiko.carstens@de.ibm.com (Heiko Carstens)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] ARM: uaccess: Implement strict user copy checks
Date: Tue, 14 Sep 2010 10:25:06 +0200	[thread overview]
Message-ID: <20100914082506.GA2201@osiris.boeblingen.de.ibm.com> (raw)
In-Reply-To: <4C8EE708.5000109@codeaurora.org>

On Mon, Sep 13, 2010 at 08:07:52PM -0700, Stephen Boyd wrote:
> Ok, I wasn't aware that only x86_32 has support for user copy checks. So
> I hacked support for that on x86_64 and then saw the kprobes.c failure.
> Great! Now for the weird(?) part.
> 
> Changing the buf_size variable from an int to a size_t makes the warning
> go away. Perhaps this is because gcc can't reliably eliminate the else
> case when the lower bound isn't 0? Overflow? I'm not really sure. Does
> the kernel/kprobes.c part of this patch work for you?
> 
[...]
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index 282035f..fa4e0f9 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -1967,7 +1967,7 @@ static ssize_t write_enabled_file_bool(struct file *file,
>  	       const char __user *user_buf, size_t count, loff_t *ppos)
>  {
>  	char buf[32];
> -	int buf_size;
> +	size_t buf_size;
> 
>  	buf_size = min(count, (sizeof(buf)-1));
>  	if (copy_from_user(buf, user_buf, buf_size))

Yes, the warning goes away on s390 as well.

WARNING: multiple messages have this Message-ID (diff)
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Russell King <linux@arm.linux.org.uk>,
	linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] ARM: uaccess: Implement strict user copy checks
Date: Tue, 14 Sep 2010 10:25:06 +0200	[thread overview]
Message-ID: <20100914082506.GA2201@osiris.boeblingen.de.ibm.com> (raw)
In-Reply-To: <4C8EE708.5000109@codeaurora.org>

On Mon, Sep 13, 2010 at 08:07:52PM -0700, Stephen Boyd wrote:
> Ok, I wasn't aware that only x86_32 has support for user copy checks. So
> I hacked support for that on x86_64 and then saw the kprobes.c failure.
> Great! Now for the weird(?) part.
> 
> Changing the buf_size variable from an int to a size_t makes the warning
> go away. Perhaps this is because gcc can't reliably eliminate the else
> case when the lower bound isn't 0? Overflow? I'm not really sure. Does
> the kernel/kprobes.c part of this patch work for you?
> 
[...]
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index 282035f..fa4e0f9 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -1967,7 +1967,7 @@ static ssize_t write_enabled_file_bool(struct file *file,
>  	       const char __user *user_buf, size_t count, loff_t *ppos)
>  {
>  	char buf[32];
> -	int buf_size;
> +	size_t buf_size;
> 
>  	buf_size = min(count, (sizeof(buf)-1));
>  	if (copy_from_user(buf, user_buf, buf_size))

Yes, the warning goes away on s390 as well.

  reply	other threads:[~2010-09-14  8:25 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-04  3:02 [PATCH] ARM: uaccess: Implement strict user copy checks Stephen Boyd
2010-08-04  3:02 ` Stephen Boyd
2010-08-10 22:46 ` Stephen Boyd
2010-08-10 22:46   ` Stephen Boyd
2010-08-10 22:55   ` Russell King - ARM Linux
2010-08-10 22:55     ` Russell King - ARM Linux
2010-08-11  0:27     ` Stephen Boyd
2010-08-11  0:27       ` Stephen Boyd
2010-08-18  1:29       ` [PATCH v2] " Stephen Boyd
2010-08-18  1:29         ` Stephen Boyd
2010-08-18 12:28         ` Arnd Bergmann
2010-08-18 12:28           ` Arnd Bergmann
2010-08-18 19:48           ` Stephen Boyd
2010-08-18 19:48             ` Stephen Boyd
2010-08-19 11:09             ` Arnd Bergmann
2010-08-19 11:09               ` Arnd Bergmann
2010-08-24 15:06               ` Heiko Carstens
2010-08-24 15:06                 ` Heiko Carstens
2010-08-24 15:26                 ` Arnd Bergmann
2010-08-24 15:26                   ` Arnd Bergmann
2010-08-24 15:47                   ` Heiko Carstens
2010-08-24 15:47                     ` Heiko Carstens
2010-08-25 12:14                     ` Arnd Bergmann
2010-08-25 12:14                       ` Arnd Bergmann
2010-08-25 12:54                       ` Heiko Carstens
2010-08-25 12:54                         ` Heiko Carstens
2010-08-25 13:55                         ` Arnd Bergmann
2010-08-25 13:55                           ` Arnd Bergmann
2010-08-25 14:40                           ` Heiko Carstens
2010-08-25 14:40                             ` Heiko Carstens
2010-08-28  1:35                             ` Stephen Boyd
2010-08-28  1:35                               ` Stephen Boyd
2010-08-28  7:43                               ` Heiko Carstens
2010-08-28  7:43                                 ` Heiko Carstens
2010-08-28  9:56                                 ` Arnd Bergmann
2010-08-28  9:56                                   ` Arnd Bergmann
2010-09-04  4:49                                 ` Stephen Boyd
2010-09-04  4:49                                   ` Stephen Boyd
2010-09-14  3:07                                   ` Stephen Boyd
2010-09-14  3:07                                     ` Stephen Boyd
2010-09-14  8:25                                     ` Heiko Carstens [this message]
2010-09-14  8:25                                       ` Heiko Carstens
2010-09-14 13:10                                       ` Arnd Bergmann
2010-09-14 13:10                                         ` Arnd Bergmann
2010-09-14 14:18                                         ` Heiko Carstens
2010-09-14 14:18                                           ` Heiko Carstens
2010-08-19  2:28           ` [PATCHv2 2/1] Consolidate CONFIG_DEBUG_STRICT_USER_COPY_CHECKS Stephen Boyd
2010-08-19  2:28             ` Stephen Boyd
2010-08-19  4:38             ` Arjan van de Ven
2010-08-19  4:38               ` Arjan van de Ven
2010-08-19  4:47             ` Stephen Rothwell
2010-08-19  4:47               ` Stephen Rothwell
2010-08-19 11:04               ` Arnd Bergmann
2010-08-19 11:04                 ` Arnd Bergmann
2010-08-11  3:04 ` [PATCH] ARM: uaccess: Implement strict user copy checks Arnd Bergmann
2010-08-11  3:04   ` Arnd Bergmann
2010-08-11 18:46   ` Stephen Boyd
2010-08-11 18:46     ` Stephen Boyd
2010-08-12 15:00     ` Arnd Bergmann
2010-08-12 15:00       ` Arnd Bergmann

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=20100914082506.GA2201@osiris.boeblingen.de.ibm.com \
    --to=heiko.carstens@de.ibm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.