Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1443105
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Miklos Szeredi <miklos@szeredi.hu> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 9/9] overlayfs: Append MAY_READ when diluting write checks |
| Date | Thu, 14 Jul 2016 08:50:02 +0200 |
| Message-ID | <rUID8-614-15@gated-at.bofh.it> (permalink) |
| References | <rUtE5-4my-5@gated-at.bofh.it> <rUtE6-4my-27@gated-at.bofh.it> |
| X-Original-To | Vivek Goyal <vgoyal@redhat.com> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Fjvg/lNhV9G2ngjAcusyBdDBLYzsSbQRjF2pHUWWITE=; b=YU4tSqko1vXLRcwXXLB5XISyGLzSKi5Fzb4Vu0xtf4vMfAymBKGc7ewgBXcM0VsfMP yHD6XOtOq+jwdNshWmbSOc0n6DjhH4RAZSrdpXGySZ3TNXgcT00kZotBhNPHxg/X30gj PQIybLvXywPVsnhisXIrY5EUhElvXbzUP6ZdQ= |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Fjvg/lNhV9G2ngjAcusyBdDBLYzsSbQRjF2pHUWWITE=; b=gJuYe/Pz1sVPSUBJ4I7ORrUIjugcOZGODST8Z+/9ASfXZQdXenPGkB7Gv3YxTksrUW NBmiddecRL4sSAzlabEBfdhW1lHbslYmdYiLRe+AKIIwSOQSWuWZmIdc5R9SzvbNZHQA J1nEeCqw0LfpGrVGp9zWDnkpPisdAxbnWw49tdyC5bq976khgXGOd8p4F1NA9ZKEruL1 3qdgOUKp3LO/brsW/wxlf6eNGZDaLxPJFL4ZWAbJ/c6cWXRsD6l+p3+IxTF5iqAXbZzR YPeXIItNuloZ1hL9IYoG2izC3HBVU/KtixcVURmJlNbQCCwpM7bcBELdAhMotWjWSjHf V+CA== |
| X-Gm-Message-State | ALyK8tJnMLAc3wzdMednTznPGvaW5nI+yy83UizGTlcQ/sAgPX63/uQKlyc2twdjljYQ1Rtq7cxsPXovzzQaBA== |
| X-Received | by 10.157.29.7 with SMTP id m7mr8187412otm.194.1468478976710; Wed, 13 Jul 2016 23:49:36 -0700 (PDT) |
| MIME-Version | 1.0 |
| X-Originating-IP | [217.173.44.24] |
| Content-Type | text/plain; charset=UTF-8 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 52 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Stephen Smalley <sds@tycho.nsa.gov>, pmoore@redhat.com, Casey Schaufler <casey@schaufler-ca.com>, linux-kernel@vger.kernel.org, "linux-unionfs@vger.kernel.org" <linux-unionfs@vger.kernel.org>, LSM <linux-security-module@vger.kernel.org>, Daniel J Walsh <dwalsh@redhat.com>, David Howells <dhowells@redhat.com>, Al Viro <viro@zeniv.linux.org.uk>, linux-fsdevel@vger.kernel.org |
| X-Original-Date | Thu, 14 Jul 2016 08:49:34 +0200 |
| X-Original-Message-ID | <CAJfpegsu=RU8bMJEi7iiHEQE4vxeByi_TwZU+-zTyTrk1Q9XeA@mail.gmail.com> |
| X-Original-References | <1468421095-22322-1-git-send-email-vgoyal@redhat.com> <1468421095-22322-10-git-send-email-vgoyal@redhat.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1443105 |
Show key headers only | View raw
On Wed, Jul 13, 2016 at 4:44 PM, Vivek Goyal <vgoyal@redhat.com> wrote:
> Right now we remove MAY_WRITE/MAY_APPEND bits from mask if realfile is
> on lower/. This is done as files on lower will never be written and will
> be copied up. But to copy up a file, mounter should have MAY_READ permission
> otherwise copy up will fail. So set MAY_READ in mask when MAY_WRITE is
> reset.
>
> Dan Walsh noticed this when he did access(lowerfile, W_OK) and it returned
> True (context mounts) but when he tried to actually write to file, it failed
> as mounter did not have permission on lower file.
>
> Reported-by: Dan Walsh <dwalsh@redhat.com>
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> ---
> fs/overlayfs/inode.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
> index 6d9d86e..83b2422 100644
> --- a/fs/overlayfs/inode.c
> +++ b/fs/overlayfs/inode.c
> @@ -140,8 +140,13 @@ int ovl_permission(struct inode *inode, int mask)
> return err;
>
> old_cred = ovl_override_creds(inode->i_sb);
> - if (!is_upper && !special_file(realinode->i_mode))
> - mask &= ~(MAY_WRITE | MAY_APPEND);
> + if (!is_upper && !special_file(realinode->i_mode)) {
> + if (mask & MAY_WRITE || mask & MAY_APPEND) {
Hmm. From what I can tell O_APPEND with O_RDONLY is equivalent to
O_RDONLY, hence MAY_APPEND without MAY_WRITE should not behave as if
MAY_WRITE was given. I.e. it should not trigger a copy up. Not sure
what MAC checks do with MAY_APPEND, though.
Pushed amended commit to overlayfs-next.
Thanks,
Miklos
> + mask &= ~(MAY_WRITE | MAY_APPEND);
> + /* Make sure mounter can read file for copy up later */
> + mask |= MAY_READ;
> + }
> + }
> err = inode_permission(realinode, mask);
> revert_creds(old_cred);
>
> --
> 2.7.4
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH 0/9][V3] Overlayfs SELinux Support Vivek Goyal <vgoyal@redhat.com> - 2016-07-13 16:50 +0200
[PATCH 6/9] security, overlayfs: Provide hook to correctly label newly created files Vivek Goyal <vgoyal@redhat.com> - 2016-07-13 16:50 +0200
Re: [PATCH 6/9] security, overlayfs: Provide hook to correctly label newly created files Stephen Smalley <sds@tycho.nsa.gov> - 2016-07-13 17:10 +0200
Re: [PATCH 6/9] security, overlayfs: Provide hook to correctly label newly created files Stephen Smalley <sds@tycho.nsa.gov> - 2016-07-13 17:10 +0200
Re: [PATCH 6/9] security, overlayfs: Provide hook to correctly label newly created files Stephen Smalley <sds@tycho.nsa.gov> - 2016-07-14 16:30 +0200
[PATCH 9/9] overlayfs: Append MAY_READ when diluting write checks Vivek Goyal <vgoyal@redhat.com> - 2016-07-13 16:50 +0200
Re: [PATCH 9/9] overlayfs: Append MAY_READ when diluting write checks Miklos Szeredi <miklos@szeredi.hu> - 2016-07-14 08:50 +0200
Re: [RFC PATCH 0/9][V3] Overlayfs SELinux Support Paul Moore <paul@paul-moore.com> - 2016-07-21 23:20 +0200
Re: [RFC PATCH 0/9][V3] Overlayfs SELinux Support James Morris <jmorris@namei.org> - 2016-07-22 01:10 +0200
Re: [RFC PATCH 0/9][V3] Overlayfs SELinux Support Miklos Szeredi <miklos@szeredi.hu> - 2016-07-22 09:10 +0200
Re: [RFC PATCH 0/9][V3] Overlayfs SELinux Support Paul Moore <paul@paul-moore.com> - 2016-07-22 17:40 +0200
csiph-web