]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
attach: switch to simple mount()
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 5 Feb 2021 20:47:56 +0000 (21:47 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 5 Feb 2021 20:49:18 +0000 (21:49 +0100)
At the point where we're remounging proc and sys we're in the container's
namespaces so there's no chance of escape so a simple mount() syscall will
suffice.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/attach.c

index c0c668bd50c0ffb2676b77c61f3bf74498286431..f705f552b5ad00606343dc8d4b2300333e7349a9 100644 (file)
@@ -734,7 +734,7 @@ int lxc_attach_remount_sys_proc(void)
        if (ret < 0)
                return log_error_errno(-1, errno, "Failed to unmount /proc");
 
-       ret = mount_filesystem("proc", "/proc", 0);
+       ret = mount("none", "/proc", "proc", 0, NULL);
        if (ret < 0)
                return log_error_errno(-1, errno, "Failed to remount /proc");
 
@@ -747,7 +747,7 @@ int lxc_attach_remount_sys_proc(void)
                return log_error_errno(-1, errno, "Failed to unmount /sys");
 
        /* Remount it. */
-       if (ret == 0 && mount_filesystem("sysfs", "/sys", 0))
+       if (ret == 0 && mount("none", "/sys", "sysfs", 0, NULL))
                return log_error_errno(-1, errno, "Failed to remount /sys");
 
        return 0;