mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-15 08:05:20 +00:00
conf: ensure umounts don't propagate to host
Signed-off-by: Fengtu Wang <wangfengtu@huawei.com> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
0474e8a8e5
commit
e599717bc5
@ -1112,7 +1112,7 @@ static int setup_rootfs_pivot_root(const char *rootfs)
|
|||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* At this point the old-root is mounted on top of our new-root To
|
/* At this point the old-root is mounted on top of our new-root. To
|
||||||
* unmounted it we must not be chdir'd into it, so escape back to
|
* unmounted it we must not be chdir'd into it, so escape back to
|
||||||
* old-root.
|
* old-root.
|
||||||
*/
|
*/
|
||||||
@ -1122,6 +1122,15 @@ static int setup_rootfs_pivot_root(const char *rootfs)
|
|||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make oldroot rslave to make sure our umounts don't propagate to the
|
||||||
|
* host.
|
||||||
|
*/
|
||||||
|
ret = mount("", ".", "", MS_SLAVE | MS_REC, NULL);
|
||||||
|
if (ret < 0) {
|
||||||
|
SYSERROR("Failed to make oldroot rslave");
|
||||||
|
goto on_error;
|
||||||
|
}
|
||||||
|
|
||||||
ret = umount2(".", MNT_DETACH);
|
ret = umount2(".", MNT_DETACH);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
SYSERROR("Failed to detach old root directory");
|
SYSERROR("Failed to detach old root directory");
|
||||||
|
Loading…
Reference in New Issue
Block a user