From: Vivek Goyal <vgoyal@redhat.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Stephen Smalley <sds@tycho.nsa.gov>,
"linux-unionfs@vger.kernel.org" <linux-unionfs@vger.kernel.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ovl: fix uid/gid when creating over whiteout
Date: Wed, 15 Jun 2016 10:20:59 -0400 [thread overview]
Message-ID: <20160615142059.GC19388@redhat.com> (raw)
In-Reply-To: <CAJfpegvopC3wA9YQ9J5khG3nCJ9zeXTpZ-SMj515vF5RMXEhNQ@mail.gmail.com>
On Wed, Jun 15, 2016 at 04:09:47PM +0200, Miklos Szeredi wrote:
> On Wed, Jun 15, 2016 at 4:01 PM, Vivek Goyal <vgoyal@redhat.com> wrote:
> > On Wed, Jun 15, 2016 at 03:30:02PM +0200, Miklos Szeredi wrote:
>
> >> --- a/fs/overlayfs/dir.c
> >> +++ b/fs/overlayfs/dir.c
> >> @@ -405,12 +405,21 @@ static int ovl_create_or_link(struct den
> >> err = ovl_create_upper(dentry, inode, &stat, link, hardlink);
> >> } else {
> >> const struct cred *old_cred;
> >> + struct cred *override_cred;
> >>
> >> old_cred = ovl_override_creds(dentry->d_sb);
> >>
> >> - err = ovl_create_over_whiteout(dentry, inode, &stat, link,
> >> - hardlink);
> >> + err = -ENOMEM;
> >> + override_cred = prepare_creds();
> >> + if (override_cred) {
> >> + override_cred->fsuid = old_cred->fsuid;
> >> + override_cred->fsgid = old_cred->fsgid;
> >
> > Hi Miklos,
> >
> > I am wondering if we are switching to tasks's ->fsuid and ->fsgid too
> > early. ovl_create_over_whiteout() calls ovl_lookup_temp(workdir) and
> > IIUC, task might not have permission to do lookup in workdir.
> >
> > Should we switch to this override_cred, just before ovl_create_real()
> > so that task ->fsuid and ->fsgid are used only for creation purposes
> > only.
>
> For lookup in workdir only CAP_DAC_OVERRIDE should matter, the actual
> value of the fsuid and fsgid should be irrelevant (user, group and
> others all have zero permission on workdir).
Ok. Agreed that CAP_DAC_OVERRIDE should do.
Thanks
Vivek
prev parent reply other threads:[~2016-06-15 14:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-15 13:30 [PATCH] ovl: fix uid/gid when creating over whiteout Miklos Szeredi
2016-06-15 14:01 ` Vivek Goyal
2016-06-15 14:09 ` Miklos Szeredi
2016-06-15 14:20 ` Vivek Goyal [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160615142059.GC19388@redhat.com \
--to=vgoyal@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=sds@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).