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: <20240311-weltmeere-gesiegt-798c4201c3f8@brauner>
Date: Mon, 11 Mar 2024 14:25:28 +0100
From: Christian Brauner <brauner@...nel.org>
To: Miklos Szeredi <miklos@...redi.hu>
Cc: Luis Henriques <lhenriques@...e.de>, Theodore Ts'o <tytso@....edu>, 
	Andreas Dilger <adilger.kernel@...ger.ca>, Alexander Viro <viro@...iv.linux.org.uk>, 
	Jan Kara <jack@...e.cz>, Amir Goldstein <amir73il@...il.com>, linux-ext4@...r.kernel.org, 
	linux-fsdevel@...r.kernel.org, linux-unionfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/3] ovl: fix the parsing of empty string mount
 parameters

On Mon, Mar 11, 2024 at 11:53:03AM +0100, Miklos Szeredi wrote:
> On Mon, 11 Mar 2024 at 11:34, Luis Henriques <lhenriques@...e.de> wrote:
> >
> > Miklos Szeredi <miklos@...redi.hu> writes:
> >
> > > On Thu, 7 Mar 2024 at 19:17, Luis Henriques <lhenriques@...e.de> wrote:
> > >>
> > >> This patch fixes the usage of mount parameters that are defined as strings
> > >> but which can be empty.  Currently, only 'lowerdir' parameter is in this
> > >> situation for overlayfs.  But since userspace can pass it in as 'flag'
> > >> type (when it doesn't have a value), the parsing will fail because a
> > >> 'string' type is assumed.
> > >
> > > I don't really get why allowing a flag value instead of an empty
> > > string value is fixing anything.
> > >
> > > It just makes the API more liberal, but for what gain?
> >
> > The point is that userspace may be passing this parameter as a flag and
> > not as a string.  I came across this issue with ext4, by doing something
> > as simple as:
> >
> >     mount -t ext4 -o usrjquota= /dev/sda1 /mnt/
> >
> > (actually, the trigger was fstest ext4/053)
> >
> > The above mount should succeed.  But it fails because 'usrjquota' is set
> > to a 'flag' type, not 'string'.
> 
> The above looks like a misparsing, since the equals sign clearly
> indicates that this is not a flag.

Yeah, so with that I do agree. But have you read my reply to the other
thread? I'd like to hear your thoughs on that. The problem is that
mount(8) currently does:

fsconfig(3, FSCONFIG_SET_FLAG, "usrjquota", NULL, 0) = -1 EINVAL (Invalid argument)

for both -o usrjquota and -o usrjquota=

So we need a clear contract with userspace or the in-kernel solution
proposed here. I see the following options:

(1) Userspace must know that mount options such as "usrjquota" that can
    have no value must be specified as "usrjquota=" when passed to
    mount(8). This in turn means we need to tell Karel to update
    mount(8) to recognize this and infer from "usrjquota=" that it must
    be passed as FSCONFIG_SET_STRING.

(2) We use the proposed in-kernel solution where relevant filesystems
    get the ability to declare this both as a string or as a flag value
    in their parameter parsing code. That's not a VFS generic thing.
    It's a per-fs thing.

(3) We burden mount(8) with knowing what mount options are string
    options that are allowed to be empty. This is clearly the least
    preferable one, imho.

(4) We add a sentinel such as "usrjquota=default" or
    "usrjquota=auto" as a VFS level keyword.

In any case, we need to document what we want:

https://github.com/brauner/man-pages-md/blob/main/fsconfig.md

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ