[lxc-devel] [PATCH] Remove /dev/kmsg symlinking.

Alexander Vladimirov alexander.idkfa.vladimirov at gmail.com
Sun Jan 6 22:22:40 UTC 2013


Symlink cannot resemble /dev/kmsg semantics, so symlinking it is wrong.
Guests probably should not use /dev/kmsg at all.
Fixes journald crashes and journal corruption in systemd guests.
---
 src/lxc/conf.c | 30 ------------------------------
 1 file changed, 30 deletions(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 4f041dc..85d72c9 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -1313,33 +1313,6 @@ static int setup_console(const struct lxc_rootfs *rootfs,
 	return setup_ttydir_console(rootfs, console, ttydir);
 }
 
-static int setup_kmsg(const struct lxc_rootfs *rootfs,
-		       const struct lxc_console *console)
-{
-	char kpath[MAXPATHLEN];
-	int ret;
-
-	if (!rootfs->path)
-		return 0;
-	ret = snprintf(kpath, sizeof(kpath), "%s/dev/kmsg", rootfs->mount);
-	if (ret < 0 || ret >= sizeof(kpath))
-		return -1;
-
-	ret = unlink(kpath);
-	if (ret && errno != ENOENT) {
-		SYSERROR("error unlinking %s\n", kpath);
-		return -1;
-	}
-
-	ret = symlink("console", kpath);
-	if (ret) {
-		SYSERROR("failed to create symlink for kmsg");
-		return -1;
-	}
-
-	return 0;
-}
-
 int setup_cgroup(const char *name, struct lxc_list *cgroups)
 {
 	struct lxc_list *iterator;
@@ -2566,9 +2539,6 @@ int lxc_setup(const char *name, struct lxc_conf *lxc_conf)
 		return -1;
 	}
 
-	if (setup_kmsg(&lxc_conf->rootfs, &lxc_conf->console))  // don't fail
-		ERROR("failed to setup kmsg for '%s'", name);
-
 	if (setup_tty(&lxc_conf->rootfs, &lxc_conf->tty_info, lxc_conf->ttydir)) {
 		ERROR("failed to setup the ttys for '%s'", name);
 		return -1;
-- 
1.8.1





More information about the lxc-devel mailing list