From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755298AbbBTVpx (ORCPT ); Fri, 20 Feb 2015 16:45:53 -0500 Received: from shells.gnugeneration.com ([66.240.222.126]:40299 "HELO shells.gnugeneration.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1755140AbbBTVpv (ORCPT ); Fri, 20 Feb 2015 16:45:51 -0500 X-Greylist: delayed 401 seconds by postgrey-1.27 at vger.kernel.org; Fri, 20 Feb 2015 16:45:51 EST Date: Fri, 20 Feb 2015 15:39:10 -0600 From: vcaputo@gnugeneration.com To: linux-kernel@vger.kernel.org Cc: vito.caputo@coreos.com Subject: PROBLEM: Namespaced PID 1 ignoring SIG_DFL signals Message-ID: <20150220213910.GE8947@shells.gnugeneration.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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