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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANfQU3xMtYE8egLim0MS6N0SCCNX5yihQgafptop6ACrO8MGbw@mail.gmail.com>
Date:   Wed, 20 Jul 2022 13:11:25 -0700
From:   Jeremy Bongio <bongiojp@...il.com>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     "Darrick J. Wong" <djwong@...nel.org>,
        "Theodore Ts'o" <tytso@....edu>, linux-ext4@...r.kernel.org,
        linux-api@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v4] Add ioctls to get/set the ext4 superblock uuid.

On Wed, Jul 20, 2022 at 12:09 PM Matthew Wilcox <willy@...radead.org> wrote:
>
> On Wed, Jul 20, 2022 at 11:47:08AM -0700, Darrick J. Wong wrote:
> > On Wed, Jul 20, 2022 at 07:27:02PM +0100, Matthew Wilcox wrote:
> > > On Wed, Jul 20, 2022 at 02:00:25PM -0400, Theodore Ts'o wrote:
> > > > On Wed, Jul 20, 2022 at 03:11:21PM +0100, Matthew Wilcox wrote:
> > > > > Uhhh.  So what are the semantics of len?  That is, on SET, what does
> > > > > a filesystem do if userspace says "Here's 8 bytes" but the filesystem
> > > > > usually uses 16 bytes?  What does the same filesystem do if userspace
> > > > > offers it 32 bytes?  If the answer is "returns -EINVAL", how does
> > > > > userspace discover what size of volume ID is acceptable to a particular
> > > > > filesystem?
> > > > >
> > > > > And then, on GET, does 'len' just mean "here's the length of the buffer,
> > > > > put however much will fit into it"?  Should filesystems update it to
> > > > > inform userspace how much was transferred?
> > > >
> > > > What I'd suggest is that for GET, the length field when called should
> > > > be the length of the buffer, and if the length is too small, we should
> > > > return some error --- probably EINVAL or ENOSPC.  If the buffer size
> > > > length is larger than what is needed, having the file system update it
> > > > with the size of the UUID that was returned.
> >
> > I'd suggest something different -- calling the getfsuuid ioctl with a
> > null argument should return the filesystem's volid/uuid size as the
> > return value.  If userspace supplies a non-null argument, then fsu_len
> > has to match the filesystem's volid/uuid size or else you get EINVAL.
>
> Or userspace passes in 0 for the len and the filesystem returns -EINVAL
> and sets ->len to what the valid size would be?  There's a few ways of
> solving this.

This solution seems more intuitive to me. If EXT4_IOCTL_GETFSUUID is
called with fsu_len set to 0, then fsu_len will be set to the required
UUID length and return with an error code.

I discussed this solution when first developing the ioctl, but I left
it out since for ext4 I don't have a use case. However since other
filesystems will likely implement this ioctl, it makes sense to add.

I'll send out a new manpage with that detail added and update the code.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ