BUG in tty_open when using containers and ptrace
sukadev at linux.vnet.ibm.com
Mon Jul 13 23:49:05 PDT 2009
Grzegorz Nosek [root at localdomain.pl] wrote:
| Simply run it as container init. Sometimes it oopses immediately,
I am trying to reproduce this too and just trying to make sure I get
your environment correctly. I have just built/installed libvirt 0.6.5
on Ubuntu 9.04.
The bug does require libvirt+kvm right ? IOW, does this simple test repro
if it is run as a container-init with say lxc-start (i.e from liblxc - see
http://lxc.sourceforge.net/) ? Another simpler way to create container-init
is the ns_exec program - I assume that won't create the problem ?
Also in an earlier mail you mentioned that disabling the 'newinstance'
mount option to devpts did not help. So does your setup work with older
kernels like 2.6.28 ?
| usually it goes as far as the pause. If you kill it with SIGINT then,
| everything will probably be fine. But if you first kill the libvirt_lxc
| process above it (holding the pty master), and only then kill init, it
| should oops.
| Note that the weird mount stuff is critical here (couldn't reproduce the
| oops by simply opening /dev/pts/0, even if I mounted it on /dev/console
| After applying my patch from some earlier mail I can no longer crash the
| kernel, but the "Hello world!" appears on my current VT, so there's
| potential for container root to mess up host console. I don't know how
| that happened, actually.
| Best regards,
| Grzegorz Nosek
| #include <sys/mount.h>
| #include <fcntl.h>
| #include <unistd.h>
| #include <sys/signal.h>
| void dummy(int sig)
| int main(void)
| sleep(2); /* wait for /dev/pts/0 to appear */
| mount("/dev/pts/0", "/dev/console", NULL, MS_BIND, NULL);
| signal(SIGINT, dummy);
| open("/dev/console", O_RDWR);
| write(1, "Hello world!\n", sizeof("Hello world!\n")-1);
| return 0;
More information about the Containers