lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d953392c-44d1-4c9f-a671-b25803181b97@moroto.mountain>
Date: Tue, 7 May 2024 09:33:40 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Christoph Hellwig <hch@...radead.org>
Cc: "Darrick J. Wong" <djwong@...nel.org>,
	Chandan Babu R <chandan.babu@...cle.com>, linux-xfs@...r.kernel.org,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] xfs: check for negatives in xfs_exchange_range_checks()

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.

fs/xfs/libxfs/xfs_fs.h
   818  struct xfs_exchange_range {
   819          __s32           file1_fd;
   820          __u32           pad;            /* must be zeroes */
   821          __u64           file1_offset;   /* file1 offset, bytes */
   822          __u64           file2_offset;   /* file2 offset, bytes */
   823          __u64           length;         /* bytes to exchange */
   824  
   825          __u64           flags;          /* see XFS_EXCHANGE_RANGE_* below */
   826  };

fs/xfs/xfs_exchrange.h
    16  struct xfs_exchrange {
    17          struct file             *file1;
    18          struct file             *file2;
    19  
    20          loff_t                  file1_offset;
    21          loff_t                  file2_offset;
    22          u64                     length;
    23  
    24          u64                     flags;  /* XFS_EXCHANGE_RANGE flags */
    25  };

regards,
dan carpenter


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ