[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87d0ukjmyi.fsf@xmission.com>
Date: Tue, 14 Aug 2018 23:03:17 -0500
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Casey Schaufler <casey@...aufler-ca.com>
Cc: "Theodore Y. Ts'o" <tytso@....edu>,
Al Viro <viro@...IV.linux.org.uk>,
David Howells <dhowells@...hat.com>,
John Johansen <john.johansen@...onical.com>,
Tejun Heo <tj@...nel.org>, selinux@...ho.nsa.gov,
Paul Moore <paul@...l-moore.com>,
Li Zefan <lizefan@...wei.com>, linux-api@...r.kernel.org,
apparmor@...ts.ubuntu.com, fenghua.yu@...el.com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Eric Biggers <ebiggers@...gle.com>,
linux-security-module@...r.kernel.org,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
Johannes Weiner <hannes@...xchg.org>,
Stephen Smalley <sds@...ho.nsa.gov>,
tomoyo-dev-en@...ts.sourceforge.jp, cgroups@...r.kernel.org,
torvalds@...ux-foundation.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, Miklos Szeredi <miklos@...redi.hu>
Subject: Re: BUG: Mount ignores mount options
Casey Schaufler <casey@...aufler-ca.com> writes:
> Don't blame the filesystems for behaving as documented.
No. This behavior is not documented. At least I certainly don't see a
word about this in any of the man pages. Where does it say mounting a
filesystem will not honor it's mount options?
It is also rare enough in practice it is something it is reasonable to
expect people to be surprised by.
> The problem is not in the mount mechanism, it's in the way you want to
> abuse it.
I am not asking for this behavior. I am pointing out this behavior
exists. I am pointing out this behavior is harmful. I am asking we
stop doing this harmful thing in the new API where we don't have a
chance of breaking anything.
The place where this has bitten the hardest is someone wrote a script to
do something for Xen in a chroot. That script involved a chroot that
mounted devpts and in doing so happend to change the options of the main
/dev/pts. Which resulted in ptys created with /dev/ptmx outside the
chroot with the wrong permissions. That in turn caused several distros
to retain the ancient suid pt_chown binary from libc that the devpts
filesystem was built to make obsolete. As the world turned that
pt_chown binary could be confused into chowning the wrong pty if a pty
from a container was used.
The fix was to mount a new instance of devpts every time mount of devpts
is called. That simplified the code, and allowed pt_chown to be removed
permanently. The tricky bit was figuring out how keep /dev/ptmx
working. I wound up testing on every distribution I could think of to
ensure no one would notice the slightly changed behavior of the devpts
filesystem.
The behavior in other filesystems of ignoring the options instead of
changing them on the filesystem isn't quite as bad. But it still has
the potential for a lot of mischief.
Eric
Powered by blists - more mailing lists