public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Nick Bowler <nbowler@draconx.ca>
Cc: linux-xfs@vger.kernel.org, Brian Foster <bfoster@redhat.com>,
	Dave Chinner <david@fromorbit.com>
Subject: Re: [RFC PATCH v2 1/3] xfs: Align compat attrlist_by_handle with native implementation.
Date: Mon, 17 Dec 2018 09:34:55 -0800	[thread overview]
Message-ID: <20181217173455.GG24487@magnolia> (raw)
In-Reply-To: <20181215012259.28358-2-nbowler@draconx.ca>

On Fri, Dec 14, 2018 at 08:22:57PM -0500, Nick Bowler wrote:
> While inspecting the ioctl implementations, I noticed that the compat
> implementation of XFS_IOC_ATTRLIST_BY_HANDLE does not do exactly the
> same thing as the native implementation.  Specifically, the "cursor"
> does not appear to be written out to userspace on the compat path,
> like it is on the native path.
> 
> This adjusts the compat implementation to copy out the cursor just
> like the native implementation does.  The attrlist cursor does not
> require any special compat handling.  This fixes xfstests xfs/269
> on both IA-32 and x32 userspace, when running on an amd64 kernel.

Craaap, I forgot that when I fixed the native attrlist_by_handle. :(

> Signed-off-by: Nick Bowler <nbowler@draconx.ca>

Fixes: 0facef7fb053b ("xfs: in _attrlist_by_handle, copy the cursor back to userspace")
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_ioctl32.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
> index fba115f4103a..4c34efcbf7e8 100644
> --- a/fs/xfs/xfs_ioctl32.c
> +++ b/fs/xfs/xfs_ioctl32.c
> @@ -336,6 +336,7 @@ xfs_compat_attrlist_by_handle(
>  {
>  	int			error;
>  	attrlist_cursor_kern_t	*cursor;
> +	compat_xfs_fsop_attrlist_handlereq_t __user *p = arg;
>  	compat_xfs_fsop_attrlist_handlereq_t al_hreq;
>  	struct dentry		*dentry;
>  	char			*kbuf;
> @@ -370,6 +371,11 @@ xfs_compat_attrlist_by_handle(
>  	if (error)
>  		goto out_kfree;
>  
> +	if (copy_to_user(&p->pos, cursor, sizeof(attrlist_cursor_kern_t))) {
> +		error = -EFAULT;
> +		goto out_kfree;
> +	}
> +
>  	if (copy_to_user(compat_ptr(al_hreq.buffer), kbuf, al_hreq.buflen))
>  		error = -EFAULT;
>  
> -- 
> 2.16.1
> 

  reply	other threads:[~2018-12-17 17:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-15  1:22 [RFC PATCH v2 0/3] Fixing xfs ioctls on x32 Nick Bowler
2018-12-15  1:22 ` [RFC PATCH v2 1/3] xfs: Align compat attrlist_by_handle with native implementation Nick Bowler
2018-12-17 17:34   ` Darrick J. Wong [this message]
2018-12-15  1:22 ` [RFC PATCH v2 2/3] xfs: Fix bulkstat compat ioctls on x32 userspace Nick Bowler
2018-12-17 17:40   ` Darrick J. Wong
2018-12-17 20:06     ` Nick Bowler
2018-12-17 20:09       ` Darrick J. Wong
2018-12-15  1:22 ` [RFC PATCH v2 3/3] xfs: Fix x32 ioctls when cmd numbers differ from ia32 Nick Bowler
2018-12-17 18:18   ` Darrick J. Wong
2018-12-18  1:24 ` [RFC PATCH v2 0/3] Fixing xfs ioctls on x32 Nick Bowler

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=20181217173455.GG24487@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=bfoster@redhat.com \
    --cc=david@fromorbit.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nbowler@draconx.ca \
    /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