From: Mateusz Guzik <mguzik@redhat.com>
To: Kumar Gaurav <kumargauravgupta3@gmail.com>
Cc: kernel-janitors@vger.kernel.org,
Dan Carpenter <dan.carpenter@oracle.com>,
Greg KH <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: Clarification needed on use of put_user inside a loop
Date: Fri, 25 Apr 2014 19:05:32 +0000 [thread overview]
Message-ID: <20140425190531.GD3636@mguzik.redhat.com> (raw)
In-Reply-To: <535A88D5.3030008@gmail.com>
On Fri, Apr 25, 2014 at 09:39:57PM +0530, Kumar Gaurav wrote:
> Hence when transferring data involves loops then checking permission
> (using access_ok()) once should be good to go then after we can
> simply transfer data using __put_user(), instead of using put_user()
> itself in loop.
>
Well, I can't tell you whether this is a good idea, but:
This looks correct and other code is doing this already.
However, put_user calls might_fault, but __put_user consumers I found
(e.g. copy_siginfo_to_user) don't do that.
While it has only debugging purposes and would not change anything for
those consumers, it seems to be a bug to not include it.
Thus I suggest adding access_ok variant which calls might_fault.
--
Mateusz Guzik
WARNING: multiple messages have this Message-ID (diff)
From: Mateusz Guzik <mguzik@redhat.com>
To: Kumar Gaurav <kumargauravgupta3@gmail.com>
Cc: kernel-janitors@vger.kernel.org,
Dan Carpenter <dan.carpenter@oracle.com>,
Greg KH <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: Clarification needed on use of put_user inside a loop
Date: Fri, 25 Apr 2014 21:05:32 +0200 [thread overview]
Message-ID: <20140425190531.GD3636@mguzik.redhat.com> (raw)
In-Reply-To: <535A88D5.3030008@gmail.com>
On Fri, Apr 25, 2014 at 09:39:57PM +0530, Kumar Gaurav wrote:
> Hence when transferring data involves loops then checking permission
> (using access_ok()) once should be good to go then after we can
> simply transfer data using __put_user(), instead of using put_user()
> itself in loop.
>
Well, I can't tell you whether this is a good idea, but:
This looks correct and other code is doing this already.
However, put_user calls might_fault, but __put_user consumers I found
(e.g. copy_siginfo_to_user) don't do that.
While it has only debugging purposes and would not change anything for
those consumers, it seems to be a bug to not include it.
Thus I suggest adding access_ok variant which calls might_fault.
--
Mateusz Guzik
next prev parent reply other threads:[~2014-04-25 19:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-25 16:09 Clarification needed on use of put_user inside a loop Kumar Gaurav
2014-04-25 16:21 ` Kumar Gaurav
2014-04-25 19:05 ` Mateusz Guzik [this message]
2014-04-25 19:05 ` Mateusz Guzik
2014-04-25 21:34 ` Al Viro
2014-04-25 21:34 ` Al Viro
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=20140425190531.GD3636@mguzik.redhat.com \
--to=mguzik@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kumargauravgupta3@gmail.com \
--cc=linux-kernel@vger.kernel.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.