mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: Frederic Riss <frederic.riss@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: mount + pid namespacing broken ?
Date: Tue, 4 Jun 2013 22:51:20 +0200	[thread overview]
Message-ID: <20130604225120.34e11ac4@neptune.home> (raw)
In-Reply-To: <CAKk_3s_P18a3ZUb835ysa-MS3c-_TBT20MVsJLvPrsYKETS_-w@mail.gmail.com>

Hello,

On Sat, 01 June 2013 Frederic Riss <frederic.riss@gmail.com> wrote:
> I had a little application making use of pid and mount namespaces to
> isolate some processes on some machines. This all worked well on 3.7
> boxes. A coworker upgraded his machine and noticed that things weren't
> working anymore on 3.8. The symptom he noticed is that remounting
> /proc inside the namespaced process broke the /proc of the original
> namespace. (Remounting /proc is necessary for the pid namespace to be
> really effective)
> 
> There is a simple way to reproduce the issue if you have a new enough
> util-linux where the unshare utility accepts the --pid option. Try
> that:
> 
> bash-4.2$ unshare --pid --mount
> -bash-4.2$ sudo mount -t proc /proc /proc
> [sudo] password for friss:
> sudo: unable to send audit message: Operation not permitted
> -bash-4.2$
> 
> [ The audit failure is already a sign of something going wrong more on
> that bellow. ]
> Then in another terminal running in the root namesapce:
> 
> bash-4.2$ ls -l /proc/self
> ls: cannot read symbolic link /proc/self: No such file or directory
> lrwxrwxrwx 1 root root 0 Jun  1 23:37 /proc/self
> 
> As you see, remounting /proc in the private namespace broke the root /proc...

If your coworker updated more than the kernel it might just be that
your filesystem is `mount / --make-rshared` on the root mount namespace.
E.g. the systmed started doing that some time ago (about a year or so)

With `mount --make-rprivate` inside the new namespace before doing
anything else mount+pid+ipc+uts(+net) is working fine for me (though
I'm changing namespaces using them clone() rather than unshare())

Bruno

> Now the namespace isn't functional anyway even if /proc doesn't get remounted:
> 
> bash-4.2$ unshare --pid --mount
> -bash-4.2$ id
> uid=1001(friss) gid=1001(friss) groups=1001(friss),10(wheel)
> -bash-4.2$ id
> -bash: fork: Cannot allocate memory
> -bash-4.2$
> 
> It's able to run one process, but every following invocation will
> fail. I suppose the audit issue mentioned above is just another
> symptom.
> 
> All of this was working fine on 3.7 kernels. I tried it on latest 3.8
> and 3.9 and it fails on both. My application didn't make use of
> unshare, but instead forked a new process with the namespacing flags.
> The symptoms are identical in both cases.
> 
> Fred.

      reply	other threads:[~2013-06-04 20:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-01 21:47 Frederic Riss
2013-06-04 20:51 ` Bruno Prémont [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=20130604225120.34e11ac4@neptune.home \
    --to=bonbons@linux-vserver.org \
    --cc=frederic.riss@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®