Unverified Commit 2e5e77c5 by Christian Brauner Committed by Stéphane Graber

tree-wide: wipe references to questionable apis from our public logs

We can't do anything about the established kernel API but we can at least not propagate the terminology. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 148e709e
......@@ -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);
......
......@@ -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;
}
}
......
......@@ -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)
......
......@@ -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);
......
......@@ -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"
......
......@@ -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);
......
......@@ -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");
......
......@@ -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) {
......
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment