Linux NFS development
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH RFC 1/6] NFSD: Fix NFSv4 SETATTR's handling of large file sizes
Date: Fri, 28 Jan 2022 11:36:41 +1100	[thread overview]
Message-ID: <20220128003641.GK59715@dread.disaster.area> (raw)
In-Reply-To: <164329971128.5879.15718457509790221509.stgit@bazille.1015granger.net>

On Thu, Jan 27, 2022 at 11:08:31AM -0500, Chuck Lever wrote:
> iattr::ia_size is a loff_t. decode_fattr4() dumps a full u64 value
> in there. If that value is larger than S64_MAX, then ia_size has
> underflowed.
> 
> In this case the negative size is passed through to the VFS and
> underlying filesystems. I've observed XFS behavior: it returns
> EIO but still attempts to access past the end of the device.

What attempts to access beyond the end of the device? A file offset
is not a disk offset, and the filesystem cannot allocate blocks for
IO that are outside the device boundaries. So I don't understand how
setting an inode size of >LLONGMAX can cause the filesystem to
access blocks outside the range it can allocate and map IO to. If
this falls through to trying to access data outside the range the
filesystem is allowed to access then we've got a bug that needs to
be fixed.

Can you please clarify the behaviour that is occurring here (stack
traces demonstrating the IO path that leads to access past the end
of device would be useful) so we can look into this further?

> IOW it assumes the caller has already sanity-checked the value.

Every filesystem assumes that the iattr that is passed to ->setattr
by notify_change() has been sanity checked and the parameters are
within the valid VFS supported ranges, not just XFS. Perhaps this
check should be in notify_change, not in the callers?

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2022-01-28  0:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 16:08 [PATCH RFC 0/6] NFSD size, offset, and count sanity Chuck Lever
2022-01-27 16:08 ` [PATCH RFC 1/6] NFSD: Fix NFSv4 SETATTR's handling of large file sizes Chuck Lever
2022-01-28  0:36   ` Dave Chinner [this message]
2022-01-28  1:48     ` Chuck Lever III
2022-02-09 21:55       ` Dave Chinner
2022-01-27 16:08 ` [PATCH RFC 2/6] NFSD: Fix NFSv3 " Chuck Lever
2022-01-27 16:08 ` [PATCH RFC 3/6] NFSD: COMMIT operations must not return NFS?ERR_INVAL Chuck Lever
2022-01-27 16:08 ` [PATCH RFC 4/6] NFSD: Replace directory offset placeholder Chuck Lever
2022-01-27 16:08 ` [PATCH RFC 5/6] NFSD: Remove NFS_OFFSET_MAX Chuck Lever
2022-01-27 16:09 ` [PATCH RFC 6/6] NFSD: Clamp WRITE offsets Chuck Lever
2022-01-27 18:13 ` [PATCH RFC 0/6] NFSD size, offset, and count sanity Frank Filz

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=20220128003641.GK59715@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@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