public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Brauner <christian.brauner@canonical.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: Invalid /proc/<pid>/fd/{0,1,2} symlinks with TIOCGPTPEER
Date: Thu, 8 Mar 2018 09:19:04 +0100	[thread overview]
Message-ID: <20180308081903.GC22728@gmail.com> (raw)
In-Reply-To: <CA+55aFx+dcUPK4A19ewpjNKkes7AgmEuTcqY8wYopZ-31ujpjQ@mail.gmail.com>

On Wed, Mar 07, 2018 at 11:44:35AM -0800, Linus Torvalds wrote:
> On Wed, Mar 7, 2018 at 8:17 AM, Christian Brauner
> <christian.brauner@canonical.com> wrote:
> >
> > unshare --mount
> > mount --bind /dev/pts/ptmx /dev/ptmx
> > chmod 666 /dev/ptmx
> 
> Oh. Why are you using a bind mount in the first place?

Containers employing user namespaces can't mknod() and because of the
way some LSMs check access permissions (path-based AppArmor being one
example) a symlink to /dev/pts/ptmx won't work either so a bind-mount
seems like the most reliable solution.

> 
> Anyway, I guess we just have to add another special case for this.
> 
> Which doesn't look horrible. Right now path_pts() just does
> 
>         ret = path_parent_directory(path);
> 
> and that simply doesn't work for a bind mount file.
> 
> I think we could just change path_parent_directory() to go through
> file bind mounts. The other user is follow_dotdot(), but that always
> takes a directory, so it wouldn't be affected.
> 
> But it's probably safer to just teach path_pts to just walk up the
> bind mount first, and then do the existing path_parent_directory.
> 
> Anybody want to just try that thing?

Sure. I can try and take a look.

Christian

      reply	other threads:[~2018-03-08  8:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 16:17 Invalid /proc/<pid>/fd/{0,1,2} symlinks with TIOCGPTPEER Christian Brauner
2018-03-07 19:30 ` Eric W. Biederman
2018-03-08  8:22   ` Christian Brauner
2018-03-08 11:22     ` Christian Brauner
2018-03-07 19:44 ` Linus Torvalds
2018-03-08  8:19   ` Christian Brauner [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=20180308081903.GC22728@gmail.com \
    --to=christian.brauner@canonical.com \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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