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: <20200522195626.GV23230@ZenIV.linux.org.uk>
Date:   Fri, 22 May 2020 20:56:26 +0100
From:   Al Viro <viro@...iv.linux.org.uk>
To:     Miklos Szeredi <mszeredi@...hat.com>
Cc:     Amir Goldstein <amir73il@...il.com>,
        overlayfs <linux-unionfs@...r.kernel.org>,
        linux-fsdevel <linux-fsdevel@...r.kernel.org>,
        lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ovl: make private mounts longterm

On Fri, May 22, 2020 at 08:53:49PM +0200, Miklos Szeredi wrote:
> On Fri, May 22, 2020 at 7:02 PM Amir Goldstein <amir73il@...il.com> wrote:
> >
> > > > > -     mntput(ofs->upper_mnt);
> > > > > -     for (i = 1; i < ofs->numlayer; i++) {
> > > > > -             iput(ofs->layers[i].trap);
> > > > > -             mntput(ofs->layers[i].mnt);
> > > > > +
> > > > > +     if (!ofs->layers) {
> > > > > +             /* Deal with partial setup */
> > > > > +             kern_unmount(ofs->upper_mnt);
> > > > > +     } else {
> > > > > +             /* Hack!  Reuse ofs->layers as a mounts array */
> > > > > +             struct vfsmount **mounts = (struct vfsmount **) ofs->layers;
> > > > > +
> > > > > +             for (i = 0; i < ofs->numlayer; i++) {
> > > > > +                     iput(ofs->layers[i].trap);
> > > > > +                     mounts[i] = ofs->layers[i].mnt;
> > > > > +             }
> > > > > +             kern_unmount_many(mounts, ofs->numlayer);
> > > > > +             kfree(ofs->layers);
> > > >
> > > > That's _way_ too subtle.  AFAICS, you rely upon ->upper_mnt == ->layers[0].mnt,
> > > > ->layers[0].trap == NULL, without even mentioning that.  And the hack you do
> > > > mention...  Yecchhh...  How many layers are possible, again?
> > >
> > > 500, mounts array would fit inside a page and a page can be allocated
> > > with __GFP_NOFAIL. But why bother?  It's not all that bad, is it?
> >
> > FWIW, it seems fine to me.
> > We can transfer the reference from upperdir_trap to layers[0].trap
> > when initializing layers[0] for the sake of clarity.
> 
> Right, we should just get rid of ofs->upper_mnt and ofs->upperdir_trap
> and use ofs->layers[0] to store those.

For that you'd need to allocate ->layers before you get to ovl_get_upper(),
though.  I'm not saying it's a bad idea - doing plain memory allocations
before anything else tends to make failure exits cleaner; it's just that
it'll take some massage.  Basically, do ovl_split_lowerdirs() early,
then allocate everything you need, then do lookups, etc., filling that
stuff.

Regarding this series - the points regarding the name choice and the
need to document the calling conventions change still remain.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ