All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Walsh <dwalsh@redhat.com>
To: Vivek Goyal <vgoyal@redhat.com>, Amir Goldstein <amir73il@gmail.com>
Cc: "zhangyi (F)" <yi.zhang@huawei.com>,
	overlayfs <linux-unionfs@vger.kernel.org>,
	Miklos Szeredi <miklos@szeredi.hu>,
	miaoxie@huawei.com
Subject: Re: two questiones about overlayfs
Date: Tue, 8 Aug 2017 17:01:05 -0400	[thread overview]
Message-ID: <b0f6c871-b976-228f-001a-6c06cb329cd7@redhat.com> (raw)
In-Reply-To: <20170808202107.GB10664@redhat.com>

On 08/08/2017 04:21 PM, Vivek Goyal wrote:
> On Tue, Aug 08, 2017 at 07:01:30AM +0200, Amir Goldstein wrote:
>
> [CC Dan Walsh]
>
> [..]
>>> 2. Chattr will modify lower file's attributes directly.
>>> Reproduce:
>>> # mkdir lower upper worker merger
>>> # touch lower/aa
>>> # lsattr -p lower/aa
>>>      0 --------------e---- lower/aa
>>> # mount -t overlay -o lowerdir=lower,upperdir=upper,workdir=worker overlayfs merger
>>> # chattr -p 123 merger/aa             #set project id
>>> # lsattr -p lower/aa
>>>    123 --------------e---- lower/aa
>>>
>>> If we try to set "immutable" or any other attributes, the result are consistent.
>>> Because chattr open file in RDONLY mode, so it will not trigger copyup, and then,
>>> FS_IOC_SETFLAGS ioctl will get the lower inode and modify it.
>> Ouch! I guess it's a "known to some" issue.
>> Fixing this would be a pain (intercept ioctl and whitelisting readonly
>> fs specific ioctls).
>> Hopefully, at least sepolicy would prevent these unauthorized changes
>> to lower if
>> selinux is used??
> I tried it in a docker container on Fedora 26 host and selinux seemed to
> block it.
>
> [root@947c53c7d69a bin]# lsattr -p zcat
>      0 ------------------- zcat
>
> [root@947c53c7d69a bin]# chattr -p 123 zcat
> chattr: Permission denied while setting flags on zcat
>
> Aug 08 16:15:37  audit[24865]: AVC avc:  denied  { setattr } for
> pid=24865 comm="chattr" path="/usr/bin/zcat" dev="dm-0" ino=17358919
> scontext=system_u:system_r:container_t:s0:c403,c847
> tcontext=system_u:object_r:container_share_t:s0 tclass=file permissive=0
>
> But this should probably be properly fixed.
>
> Vivek

Yes SELinux will block all changes to the lower level.

  reply	other threads:[~2017-08-08 21:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-07  7:57 two questiones about overlayfs zhangyi (F)
2017-08-08  5:01 ` Amir Goldstein
2017-08-08 20:21   ` Vivek Goyal
2017-08-08 21:01     ` Daniel Walsh [this message]
2017-08-15 10:22   ` Miklos Szeredi
2017-08-15 13:35   ` Miklos Szeredi
2017-08-15 14:52     ` Amir Goldstein
2017-08-15 15:06       ` Miklos Szeredi
2017-08-15 15:28         ` Amir Goldstein
2017-08-15 15:33           ` Miklos Szeredi
2017-08-15 15:53             ` Amir Goldstein
2017-08-15 15:56             ` Vivek Goyal
2017-08-15 16:16               ` Amir Goldstein
2017-08-16 10:19                 ` Miklos Szeredi
2017-08-16 10:20                   ` Miklos Szeredi
2017-08-16 11:10                   ` Amir Goldstein
2017-08-17  2:55                     ` zhangyi (F)
2017-08-17  7:49                       ` Amir Goldstein
2017-08-16 13:52                   ` Vivek Goyal
2017-08-16 16:12                     ` Amir Goldstein
2017-08-16 18:37                       ` Vivek Goyal
2017-09-11 13:34 ` Amir Goldstein
2017-09-12  1:07   ` zhangyi (F)

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=b0f6c871-b976-228f-001a-6c06cb329cd7@redhat.com \
    --to=dwalsh@redhat.com \
    --cc=amir73il@gmail.com \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miaoxie@huawei.com \
    --cc=miklos@szeredi.hu \
    --cc=vgoyal@redhat.com \
    --cc=yi.zhang@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.