PROBLEM: Namespaced PID 1 ignoring SIG_DFL signals

From: vcaputo
Date: Fri Feb 20 2015 - 16:45:55 EST


Hello lkml,

According to the comment:

> * Note that if global/container-init sees a sig_kernel_only()
> * signal here, the signal must have been generated internally
> * or must have come from an ancestor namespace. In either
> * case, the signal cannot be dropped.

[https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/kernel/signal.c?id=refs/tags/v3.19#n2290]

Killing a container's PID1 shouldn't be ignored when the default-handled
signal originated from an ancestor namespace or internally.

When executing via `unshare --fork --pid` a trivial "for(;;) pause();" C
program that installs no signal handlers, then sending SIGTERM to the
namespaced process from the parent namespace, the pause() syscall just
returns EINTR and loops rather than the process terminating.

This does not seem consistent with the intention documented in the code.

Additionally, if using a more comprehensive executor than unshare which
allocates a pty for the child and sets the pty slave as the controlling
tty pre-exec, running the same test the signals delivered by the pty
slave are identically ignored. It's unclear to me whether signals
originating from the process' own controlling tty would be classified as
"generated internally".

IMHO both of these scenarios should result in the signal being handled,
but if that's inappropriate I'd appreciate any clarification.

Please CC me with any responses, as I'm not subscribed.

Thanks,
Vito Caputo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/