lkml.org 
[lkml]   [2014]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: How is pivot_root intended to be used?
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


\
 
 \ /
  Last update: 2014-09-02 22:21    [W:0.049 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site