public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: Steven Stewart-Gallus <sstewartgallus00@mylangara.bc.ca>,
	linux-kernel@vger.kernel.org
Subject: Re: How is pivot_root intended to be used?
Date: Tue, 02 Sep 2014 12:53:14 -0700	[thread overview]
Message-ID: <5406202A.30401@amacapital.net> (raw)
In-Reply-To: <fc0cb509956.5404e2cc@langara.bc.ca>

On 09/01/2014 02:19 PM, Steven Stewart-Gallus wrote:
> Hello,
>
> I am not confused about how I can currently use pivot_root for
> containers on my kernel (version 3.13). Currently a sequence like:
>
>      if (-1 == syscall(__NR_pivot_root, ".", ".")) {
>          perror("pivot_root");
>          return EXIT_FAILURE;
>      }
>
>      if (-1 == umount2(".", MNT_DETACH)) {
>          perror("umount");
>          return EXIT_FAILURE;

Given the comment, you don't know what '.' refers to in the umount2 call 
above.  In fact, I think you're actually detaching the wrong thing, 
leaving possible security issues.

See:

https://github.com/sandstorm-io/sandstorm/blob/master/src/sandstorm/supervisor-main.c%2B%2B#L922

for a program that does this more carefully.

--Andy

  reply	other threads:[~2014-09-02 19:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-01 21:19 How is pivot_root intended to be used? Steven Stewart-Gallus
2014-09-02 19:53 ` Andy Lutomirski [this message]
2014-09-04  7:35   ` Steven Stewart-Gallus

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=5406202A.30401@amacapital.net \
    --to=luto@amacapital.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sstewartgallus00@mylangara.bc.ca \
    /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