public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
	Chandan Babu R <chandan.babu@oracle.com>,
	linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] xfs: check for negatives in xfs_exchange_range_checks()
Date: Tue, 7 May 2024 16:36:45 -0700	[thread overview]
Message-ID: <20240507233645.GZ360919@frogsfrogsfrogs> (raw)
In-Reply-To: <ZjnM2QBtL68KJtio@infradead.org>

On Mon, May 06, 2024 at 11:40:25PM -0700, Christoph Hellwig wrote:
> On Tue, May 07, 2024 at 09:33:40AM +0300, Dan Carpenter wrote:
> > On Mon, May 06, 2024 at 11:06:17PM -0700, Christoph Hellwig wrote:
> > > On Sat, May 04, 2024 at 02:27:36PM +0300, Dan Carpenter wrote:
> > > > The fxr->file1_offset and fxr->file2_offset variables come from the user
> > > > in xfs_ioc_exchange_range().  They are size loff_t which is an s64.
> > > > Check the they aren't negative.
> > > > 
> > > > Fixes: 9a64d9b3109d ("xfs: introduce new file range exchange ioctl")
> > > 
> > > In this commit file1_offset and file2_offset are u64.  They used to
> > > be u64 in the initial submission, but we changed that as part of the
> > > review process.
> > 
> > I've just checked again, and I think it was loff_t in that commit.
> > There are two related structs, the one that's userspace API and the
> > one that's internal.  The userspace API is u64 but internally it's
> > loff_t.
> 
> Ah, yes.  The in-kernel ones probably just needs to move to use u64
> as well.

I don't think we want userspace to be able to exchangerange data at file
positions that they can't read or write with a standard fs syscall.

--D

  reply	other threads:[~2024-05-07 23:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-04 11:27 [PATCH] xfs: check for negatives in xfs_exchange_range_checks() Dan Carpenter
2024-05-04 16:46 ` Markus Elfring
2024-05-07  6:06 ` Christoph Hellwig
2024-05-07  6:33   ` Dan Carpenter
2024-05-07  6:40     ` Christoph Hellwig
2024-05-07 23:36       ` Darrick J. Wong [this message]
2024-05-07 23:33 ` Darrick J. Wong
2024-05-08  1:29 ` Dave Chinner
2024-05-08  2:26   ` Darrick J. Wong
2024-05-08  9:20   ` Dan Carpenter

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=20240507233645.GZ360919@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=chandan.babu@oracle.com \
    --cc=dan.carpenter@linaro.org \
    --cc=hch@infradead.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox