]> git.proxmox.com Git - mirror_lxc.git/commitdiff
tree-wide: wipe references to questionable apis from our public logs
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 18 Jun 2020 07:53:34 +0000 (09:53 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 18 Jun 2020 08:05:10 +0000 (10:05 +0200)
We can't do anything about the established kernel API but we can at least not
propagate the terminology.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/attach.c
src/lxc/cmd/lxc_usernsexec.c
src/lxc/conf.c
src/lxc/conf.h
src/lxc/lsm/apparmor.c
src/lxc/lxccontainer.c
src/lxc/start.c
src/lxc/storage/rsync.c
src/lxc/storage/storage_utils.c

index 1b7e5c650fdf0cc241ceac7984a0504fcee37a66..38e16f2d1e48ff9c1a4b8e182b9fd7705d59e12a 100644 (file)
@@ -194,12 +194,8 @@ int lxc_attach_remount_sys_proc(void)
        if (ret < 0)
                return log_error_errno(-1, errno, "Failed to unshare mount namespace");
 
-       if (detect_shared_rootfs()) {
-               if (mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL)) {
-                       SYSERROR("Failed to make / rslave");
-                       ERROR("Continuing...");
-               }
-       }
+       if (detect_shared_rootfs() && mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL))
+               SYSERROR("Failed to recursively turn root mount tree into dependent mount. Continuing...");
 
        /* Assume /proc is always mounted, so remount it. */
        ret = umount2("/proc", MNT_DETACH);
index 3c22482f4f6c2ceed724a459567da6d22a9fd89e..aee7448ce1c014ee975dcae4e1776222db9d252b 100644 (file)
@@ -103,7 +103,7 @@ static int do_child(void *vargv)
        if (detect_shared_rootfs()) {
                ret = mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL);
                if (ret < 0) {
-                       CMD_SYSINFO("Failed to make \"/\" rslave");
+                       CMD_SYSINFO("Failed to recursively turn root mount tree into dependent mount");
                        return -1;
                }
        }
index 13f7619fd0f9777622d33617acfe9df14224b46b..4aafca3cbb5f5c3fcb5a4a94883752f8563470ad 100644 (file)
@@ -1232,7 +1232,7 @@ static int lxc_mount_rootfs(struct lxc_conf *conf)
        if (!rootfs->path) {
                ret = mount("", "/", NULL, MS_SLAVE | MS_REC, 0);
                if (ret < 0)
-                       return log_error_errno(-1, errno, "Failed to remount \"/\" MS_REC | MS_SLAVE");
+                       return log_error_errno(-1, errno, "Failed to recursively turn root mount tree into dependent mount");
 
                return 0;
        }
@@ -1409,12 +1409,12 @@ static int lxc_pivot_root(const char *rootfs)
        if (ret < 0)
                return log_error_errno(-1, errno, "Failed to enter old root directory");
 
-       /* Make oldroot rslave to make sure our umounts don't propagate to the
+       /* Make oldroot a depedent mount to make sure our umounts don't propagate to the
         * host.
         */
        ret = mount("", ".", "", MS_SLAVE | MS_REC, NULL);
        if (ret < 0)
-               return log_error_errno(-1, errno, "Failed to make oldroot rslave");
+               return log_error_errno(-1, errno, "Failed to recursively turn old root mount tree into dependent mount");
 
        ret = umount2(".", MNT_DETACH);
        if (ret < 0)
@@ -2923,8 +2923,8 @@ void tmp_proc_unmount(struct lxc_conf *lxc_conf)
        lxc_conf->tmp_umount_proc = false;
 }
 
-/* Walk /proc/mounts and change any shared entries to slave. */
-void remount_all_slave(void)
+/* Walk /proc/mounts and change any shared entries to dependent mounts. */
+void turn_into_dependent_mounts(void)
 {
        __do_free char *line = NULL;
        __do_fclose FILE *f = NULL;
@@ -3001,13 +3001,12 @@ again:
                null_endofword(target);
                ret = mount(NULL, target, NULL, MS_SLAVE, NULL);
                if (ret < 0) {
-                       SYSERROR("Failed to make \"%s\" MS_SLAVE", target);
-                       ERROR("Continuing...");
+                       SYSERROR("Failed to recursively turn old root mount tree into dependent mount. Continuing...");
                        continue;
                }
-               TRACE("Remounted \"%s\" as MS_SLAVE", target);
+               TRACE("Recursively turned old root mount tree into dependent mount");
        }
-       TRACE("Remounted all mount table entries as MS_SLAVE");
+       TRACE("Turned all mount table entries into dependent mount");
 }
 
 static int lxc_execute_bind_init(struct lxc_handler *handler)
@@ -3083,7 +3082,7 @@ int lxc_setup_rootfs_prepare_root(struct lxc_conf *conf, const char *name,
                return log_trace(0, "Bind mounted container / onto itself");
        }
 
-       remount_all_slave();
+       turn_into_dependent_mounts();
 
        ret = run_lxc_hooks(name, "pre-mount", conf, NULL);
        if (ret < 0)
index 17cec5d596a85f728cfa1ab6adaef88f16b64f83..b72afbaa569607200e1f2556571ebd1a6543a149 100644 (file)
@@ -451,7 +451,7 @@ extern int parse_mntopts(const char *mntopts, unsigned long *mntflags,
                         char **mntdata);
 extern int parse_propagationopts(const char *mntopts, unsigned long *pflags);
 extern void tmp_proc_unmount(struct lxc_conf *lxc_conf);
-extern void remount_all_slave(void);
+extern void turn_into_dependent_mounts(void);
 extern void suggest_default_idmap(void);
 extern FILE *make_anonymous_mount_file(struct lxc_list *mount,
                                       bool include_nesting_helpers);
index cef95c854243e3f43513721fb49d7ae6c9f11702..02f824f975db164a9208fc371fb75076f366732c 100644 (file)
@@ -121,7 +121,7 @@ static const char AA_PROFILE_BASE[] =
 "  # deny reads from debugfs\n"
 "  deny /sys/kernel/debug/{,**} rwklx,\n"
 "\n"
-"  # allow paths to be made slave, shared, private or unbindable\n"
+"  # allow paths to be made dependent, shared, private or unbindable\n"
 "  # TODO: This currently doesn't work due to the apparmor parser treating those as allowing all mounts.\n"
 "#  mount options=(rw,make-slave) -> **,\n"
 "#  mount options=(rw,make-rslave) -> **,\n"
index f872a5f703df834180902a315efa1d4254ddbb7c..51422a56de88391f91941199b4d5873625402b36 100644 (file)
@@ -1065,7 +1065,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
 
                ret = mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL);
                if (ret < 0) {
-                       SYSERROR("Failed to make / rslave at startup");
+                       SYSERROR("Failed to recursively turn root mount tree into dependent mount. Continuing...");
                        lxc_put_handler(handler);
                        ret = 1;
                        goto on_error;
@@ -1345,14 +1345,8 @@ static bool create_run_template(struct lxc_container *c, char *tpath,
                                _exit(EXIT_FAILURE);
                        }
 
-                       ret = detect_shared_rootfs();
-                       if (ret == 1) {
-                               ret = mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL);
-                               if (ret < 0) {
-                                       SYSERROR("Failed to make \"/\" rslave");
-                                       ERROR("Continuing...");
-                               }
-                       }
+                       if (detect_shared_rootfs() && mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL))
+                               SYSERROR("Failed to recursively turn root mount tree into dependent mount. Continuing...");
                }
 
                if (strcmp(bdev->type, "dir") != 0 && strcmp(bdev->type, "btrfs") != 0) {
@@ -3671,12 +3665,8 @@ static int clone_update_rootfs(struct clone_update_data *data)
                        return -1;
                }
 
-               if (detect_shared_rootfs()) {
-                       if (mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL)) {
-                               SYSERROR("Failed to make / rslave");
-                               ERROR("Continuing...");
-                       }
-               }
+               if (detect_shared_rootfs() && mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL))
+                       SYSERROR("Failed to recursively turn root mount tree into dependent mount. Continuing...");
 
                if (bdev->ops->mount(bdev) < 0) {
                        storage_put(bdev);
index 5d57972266b995763b193b952ac528155cf5c70f..fd969c4332c26a9ffaf141ae32111f8c8d510472 100644 (file)
@@ -1935,7 +1935,7 @@ int __lxc_start(struct lxc_handler *handler, struct lxc_operations *ops,
                        }
                        INFO("Unshared CLONE_NEWNS");
 
-                       remount_all_slave();
+                       turn_into_dependent_mounts();
                        ret = lxc_setup_rootfs_prepare_root(conf, name, lxcpath);
                        if (ret < 0) {
                                ERROR("Error setting up rootfs mount as root before spawn");
index 97678dea27b9155c96bc6c053803a1fc6fed9a5d..2e4df25374c35d0a2fc901fd6ee34d8d7e01120b 100644 (file)
@@ -78,12 +78,8 @@ int lxc_rsync(struct rsync_data *data)
                return -1;
        }
 
-       ret = detect_shared_rootfs();
-       if (ret) {
-               ret = mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL);
-               if (ret < 0)
-                       SYSERROR("Failed to make \"/\" a slave mount");
-       }
+       if (detect_shared_rootfs() && mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL))
+               SYSERROR("Failed to recursively turn root mount tree into dependent mount");
 
        ret = orig->ops->mount(orig);
        if (ret < 0) {
index a3ee353e5e4ddc590f12223b43127db6ca3cf450..f96bd520ba8ee5798d7d19c2bbba70f8a0c298cd 100644 (file)
@@ -165,11 +165,8 @@ int detect_fs(struct lxc_storage *bdev, char *type, int len)
        if (unshare(CLONE_NEWNS) < 0)
                _exit(EXIT_FAILURE);
 
-       if (detect_shared_rootfs())
-               if (mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL)) {
-                       SYSERROR("Failed to make / rslave");
-                       ERROR("Continuing...");
-               }
+       if (detect_shared_rootfs() && mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL))
+               SYSERROR("Failed to recursively turn root mount tree into dependent mount. Continuing...");
 
        ret = mount_unknown_fs(srcdev, bdev->dest, bdev->mntopts);
        if (ret < 0) {