[Lxc-users] PID namespace behavior

Arun M arunmahadevaiyer at gmail.com
Wed Apr 11 08:16:10 UTC 2012


Hello,

I am observing that if two containers are spawned via lxc-execute and if
these happen to be in  the same process group, a process inside one
container can terminate the second container by sending a SIGTERM to the
process group.


Code snippet of the test program that was running inside the container (via
lxc-execute):-
--
void handle_term(int sig)
{
  signal(SIGTERM, SIG_DFL);
  kill(0, SIGTERM);
}

int main()
{
  signal(SIGTERM, handle_term);
  sleep(3600);
}
----

I forked two copies of this via lxc-execute and made sure that they have
the same process group ID and sent a SIGTERM to the first lxc-execute.

The second container (where SIGTERM was not sent) apparently gets a SIGTERM
from PID 2 of the first container.

---
write(3, "    lxc-execute 1334131101.756 INFO     lxc_start - received
 signal 15 from pid 2, uid 36886\n", 94) = 94
write(3, "    lxc-execute 1334131101.756 INFO     lxc_start - forwarded
signal 15 to pid 14875\n", 85) = 85
---

Is this expected behavior ? Shouldn't two process in independent PID
namespaces get their own copy of process group IDs ?


Thanks,
Arun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20120411/eedf046b/attachment.html>


More information about the lxc-users mailing list