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: <Y9P0hhHSFq/OBZjt@redhat.com>
Date:   Fri, 27 Jan 2023 10:57:58 -0500
From:   Vivek Goyal <vgoyal@...hat.com>
To:     Amir Goldstein <amir73il@...il.com>
Cc:     Giuseppe Scrivano <gscrivan@...hat.com>,
        Dave Chinner <david@...morbit.com>,
        Alexander Larsson <alexl@...hat.com>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        brauner@...nel.org, viro@...iv.linux.org.uk,
        Miklos Szeredi <miklos@...redi.hu>
Subject: Re: [PATCH v3 0/6] Composefs: an opportunistically sharing verified
 image filesystem

On Wed, Jan 25, 2023 at 10:23:08PM +0200, Amir Goldstein wrote:
> On Wed, Jan 25, 2023 at 9:45 PM Giuseppe Scrivano <gscrivan@...hat.com> wrote:
> >
> > Amir Goldstein <amir73il@...il.com> writes:
> >
> > >> >> I previously mentioned my wish of using it from a user namespace, the
> > >> >> goal seems more challenging with EROFS or any other block devices.  I
> > >> >> don't know about the difficulty of getting overlay metacopy working in a
> > >> >> user namespace, even though it would be helpful for other use cases as
> > >> >> well.
> > >> >>
> > >> >
> > >> > There is no restriction of metacopy in user namespace.
> > >> > overlayfs needs to be mounted with -o userxattr and the overlay
> > >> > xattrs needs to use user.overlay. prefix.
> > >>
> > >> if I specify both userxattr and metacopy=on then the mount ends up in
> > >> the following check:
> > >>
> > >> if (config->userxattr) {
> > >>         [...]
> > >>         if (config->metacopy && metacopy_opt) {
> > >>                 pr_err("conflicting options: userxattr,metacopy=on\n");
> > >>                 return -EINVAL;
> > >>         }
> > >> }
> > >>
> > >
> > > Right, my bad.
> > >
> > >> to me it looks like it was done on purpose to prevent metacopy from a
> > >> user namespace, but I don't know the reason for sure.
> > >>
> > >
> > > With hand crafted metacopy, an unpriv user can chmod
> > > any files to anything by layering another file with different
> > > mode on top of it....
> >
> > I might be missing something obvious about metacopy, so please correct
> > me if I am wrong, but I don't see how it is any different than just
> > copying the file and chowning it.  Of course, as long as overlay uses
> > the same security model so that a file that wasn't originally possible
> > to access must be still blocked, even if referenced through metacopy.
> >
> 
> You're right.
> The reason for mutual exclusion maybe related to the
> comment in ovl_check_metacopy_xattr() about EACCES.
> Need to check with Vivek or Miklos.
> 
> But get this - you do not need metacopy=on to follow lower inode.
> It should work without metacopy=on.
> metacopy=on only instructs overlayfs whether to copy up data
> or only metadata when changing metadata of lower object, so it is
> not relevant for readonly mount.

I think you might need metacopy=on even to just follow lower inode. I
see following in ovl_lookup().

                if ((uppermetacopy || d.metacopy) && !ofs->config.metacopy) {
                        dput(this);
                        err = -EPERM;
                        pr_warn_ratelimited("refusing to follow metacopy origin for (%pd2)\n", dentry); 
                        goto out_put;
                }

W.r.t allowing metacopy=on from inside userns, I never paid much attention
to this as I never needed it. But this might be interesting to look into
it now if it is needed.

Thanks
Vivek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ