Re: [PATCH v2 3/3] ovl: fix the parsing of empty string mount parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 11, 2024 at 11:53:03AM +0100, Miklos Szeredi wrote:
> On Mon, 11 Mar 2024 at 11:34, Luis Henriques <lhenriques@xxxxxxx> wrote:
> >
> > Miklos Szeredi <miklos@xxxxxxxxxx> writes:
> >
> > > On Thu, 7 Mar 2024 at 19:17, Luis Henriques <lhenriques@xxxxxxx> 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




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux