[lxc-devel] Permission of /dev/null to 0600 when booting daemon mode without logging
Ryousei Takano
takano-ryousei at aist.go.jp
Fri Jan 29 09:12:29 UTC 2010
Hi daniel and all,
I have ran the CentOS 5 container on the CentOS 5. When lxc-start executes with daemon mode
and without logging, the permission of /dev/null on the host OS changes from 0666 to 0600.
I guess it is because lxc uses bind mount due to remap from /dev/console to /dev/null with daemon
mode. The container OS changes the permission of /dev/console at its boot process, and then it
influences /dev/null on the host OS.
I do not know whether this problem occurs on the other distros.
Here is a simple reproduction code:
#include <stdio.h>
#include <unistd.h>
#include <sys/mount.h>
int
main()
{
/* [LXC] setup_console (lxc/conf.c) */
if (mount("/dev/null", "/dev/console", "none", MS_BIND, 0)) { /* (1) */
perror("mount");
return -1;
}
/* [CentOS] ??? */
if (chmod("/dev/console", 0600)) { /* (2) */
perror("chmod");
return -1;
}
if (umount("/dev/console")) {
perror("umount");
return -1;
}
return 0;
}
Any comments and suggestions will be welcome.
Thanks,
Ryousei
More information about the lxc-devel
mailing list