All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [RFC PATCH 5/5] gfs2: Add xreaddir file operation and supporting functions
Date: Wed, 30 Jul 2014 10:06:13 +0100	[thread overview]
Message-ID: <53D8B585.7000104@redhat.com> (raw)
In-Reply-To: <584806381.15003446.1406672757956.JavaMail.zimbra@redhat.com>


On 29/07/14 23:25, Abhijith Das wrote:
>
> ----- Original Message -----
>> From: "Jonathan Corbet" <corbet@lwn.net>
>> To: "Abhi Das" <adas@redhat.com>
>> Cc: linux-kernel at vger.kernel.org, linux-fsdevel at vger.kernel.org, cluster-devel at redhat.com
>> Sent: Tuesday, July 29, 2014 1:58:08 PM
>> Subject: Re: [RFC PATCH 5/5] gfs2: Add xreaddir file operation and supporting functions
[snip]
>>> +	if ((xc->xc_xattr_mask & XSTAT_XATTR_ALL) &&
>>> +		lxd->xd_blob.xb_xattr_count) {
>> How can that be right?  lxd is __user, it doesn't seem right to be
>> dereferencing it directly...?
> Wouldn't the call to access_ok() at the start of the syscall take care of this? All the
> __user pointers point to areas within the user supplied buffer buf and overflow past the
> end of the buffer for the last lxd is checked for.
>
> The 2/5 patch in this series adds the following in fs/readdir.c:
>
> +SYSCALL_DEFINE5(xgetdents, unsigned int, fd, unsigned, flags, unsigned int, mask,
> +               void __user *, buf, unsigned int, count)
> ...
> ...
> ...
> +       if (!access_ok(VERIFY_WRITE, buf, count))
> +               return -EFAULT;
>
The access_ok() call only checks the source memory at the time of the 
call, it is possible for the page to become invalid for reading or 
writing to at any subsequent time. So that the kernel's accessor 
functions are required here. I think sparse should warn about this too.

However, the intention was to show that the xreaddir approach is not 
ideal due to its complexity, and also due to it being very much single 
purpose compared with the readahead approach, and from that point of 
view it shouldn't affect the performance measurements in this case,

Steve.



  reply	other threads:[~2014-07-30  9:06 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 17:38 [Cluster-devel] [RFC PATCH 0/5] xgetdents system call Abhi Das
2014-07-25 17:38 ` Abhi Das
2014-07-25 17:38 ` [Cluster-devel] [RFC PATCH 1/5] fs: xstat system call VFS bits Abhi Das
2014-07-25 17:38   ` Abhi Das
2014-07-25 17:38   ` Abhi Das
2014-07-25 18:17   ` [Cluster-devel] " Bob Peterson
2014-07-25 18:17     ` Bob Peterson
2014-07-25 17:38 ` [Cluster-devel] [RFC PATCH 2/5] fs: Add xgetdents system call and xreaddir file operation Abhi Das
2014-07-25 17:38   ` Abhi Das
2014-07-25 17:38   ` Abhi Das
2014-07-29  8:20   ` [Cluster-devel] " Michael Kerrisk
2014-07-29  8:20     ` Michael Kerrisk
2014-07-29  8:20     ` Michael Kerrisk
2014-07-25 17:38 ` [Cluster-devel] [RFC PATCH 3/5] gfs2: Add a dynamic buffer backed by a vector of pages Abhi Das
2014-07-25 17:38   ` Abhi Das
2014-07-25 17:38   ` Abhi Das
2014-07-25 18:42   ` [Cluster-devel] " Bob Peterson
2014-07-25 18:42     ` Bob Peterson
2014-07-25 17:38 ` [Cluster-devel] [RFC PATCH 4/5] gfs2: Add sort functionality with extra parameter Abhi Das
2014-07-25 17:38   ` Abhi Das
2014-07-25 17:38 ` [Cluster-devel] [RFC PATCH 5/5] gfs2: Add xreaddir file operation and supporting functions Abhi Das
2014-07-25 17:38   ` Abhi Das
2014-07-29 18:58   ` [Cluster-devel] " Jonathan Corbet
2014-07-29 18:58     ` Jonathan Corbet
2014-07-29 22:25     ` [Cluster-devel] " Abhijith Das
2014-07-29 22:25       ` Abhijith Das
2014-07-30  9:06       ` Steven Whitehouse [this message]
2014-07-30 13:57       ` [Cluster-devel] " Jonathan Corbet
2014-07-30 13:57         ` Jonathan Corbet
2014-07-29  8:18 ` [Cluster-devel] [RFC PATCH 0/5] xgetdents system call Michael Kerrisk
2014-07-29  8:18   ` Michael Kerrisk
2014-07-29  8:18   ` Michael Kerrisk

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=53D8B585.7000104@redhat.com \
    --to=swhiteho@redhat.com \
    /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.