lkml.org 
[lkml]   [2007]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: sys_chroot+sys_fchdir Fix
Quoting David Newall (david@davidnewall.com):
> Bill Davidsen wrote:
>> there is no question that pivot_root is intended to have breadth for more
>> than one process.
>
> I think it's clear from the man page that the original idea was to be able
> to pivot_root for individual processes. The reason it doesn't do that, the
> reason it affects all processes, is to work around the bootstrap problem,
> where processes that don't care what their root (or current) directory is
> are still using the original root.
>
> An extra parameter could be added to specify which behavior is desired,
> probably defaulting to the current behavior. That would remove the need to
> use a chroot bug.

No reason for any new parameters to pivot_root. Just clone your mounts
namespace first.

unshare(CLONE_NEWNS);
chdir(new_dir);
pivot_root(new_dir, oldroot);

Since pivot_root actually fiddles with the vfsmnts, this is really the
only way to go about having it "work with just one process".

-serge

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-09-24 23:35    [W:0.123 / U:0.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site