diff options
author | Andrian Nord <nightnord@gmail.com> | 2009-11-26 16:46:25 +0100 |
---|---|---|
committer | Diego Elio 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2009-12-11 17:49:28 +0100 |
commit | 58ed8c8138246043b0ce0a503939ef84f6de02e3 (patch) | |
tree | 9874cf15b85b36f2ae5f608c09f260bcd47843fe | |
parent | pass lxc_conf to the lxc_start function instead of the rcfile (diff) | |
download | lxc-58ed8c8138246043b0ce0a503939ef84f6de02e3.tar.gz lxc-58ed8c8138246043b0ce0a503939ef84f6de02e3.tar.bz2 lxc-58ed8c8138246043b0ce0a503939ef84f6de02e3.zip |
"Default" configuration may destroy host systemlxc_0_6_4-gentoo-1
If you're running (by mistake or typo) (via lxc-start) container that does not
exists it will run with lxc.rootfs=/, meaning that /sbin/init will
restart initialization procedure, efficiently messing host's system,
that may lead to unpredictable results or even destroy (make inaccessible) host
system (by reseting network configuration or something like that).
(Actually, it _did_ destroy system of everyone who tested this).
Actually, I finally lost any meaning of having such a feature for
full-system containers. You may not use hosts's FS - it's described at
above. You may not use some temporary directory - that's nonsense.
This patch forbinds starting container via lxc-start without rcfile and
custom start program, but probably it fixes only small part of problem.
I really don't see much sense in such a feature without ability of
overriding 'default' setting with command line switches. Anyway, default
behaviour should be as save as possible.
Signed-off-by: Andrian Nord <NightNord@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
-rw-r--r-- | src/lxc/lxc_start.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lxc/lxc_start.c b/src/lxc/lxc_start.c index b8d03e8..d2471eb 100644 --- a/src/lxc/lxc_start.c +++ b/src/lxc/lxc_start.c @@ -173,6 +173,11 @@ int main(int argc, char *argv[]) return err; } + if (!rcfile && !strcmp("/sbin/init", args[0])) { + ERROR("no configuration file for '/sbin/init' (may crash the host)"); + return err; + } + if (my_args.daemonize) { /* do not chdir as we want to open the log file, |