lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140424022457.GV18016@ZenIV.linux.org.uk>
Date:	Thu, 24 Apr 2014 03:24:57 +0100
From:	Al Viro <viro@...IV.linux.org.uk>
To:	Andy Lutomirski <luto@...capital.net>
Cc:	Richard Weinberger <richard.weinberger@...il.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Linux FS Devel <linux-fsdevel@...r.kernel.org>
Subject: Re: How do I make a clean mount namespace?

On Wed, Apr 23, 2014 at 05:54:31PM -0700, Andy Lutomirski wrote:

> This requires CAP_SYS_ADMIN and it requires that the caller is not
> chrooted.  path must be a mountpoint and flags must be zero.
> 
> It lazy-unmounts everything outside path, and it moves path to /.
> When it's done, the current process's root is '/'.  If you want to
> retain temporary access to outside things, you can keep an fd open.
> If the old root is shared, it is made private.  It's okay for path to
> be shared (I think).
> 
> If other things are already running in the current mount namespace,
> then their root directory stays the same, so they keep working, but
> they may be a little confused.
> 
> I think this could replace pivot_root for most use cases, and it could
> simplify programs like switch_root.
> 
> Thoughts?

chdir(new);
pivot_root(".", old);
umount(old, MNT_DETACH);
chroot(".");
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ