From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752017AbbKETV2 (ORCPT ); Thu, 5 Nov 2015 14:21:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59578 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751691AbbKETV0 (ORCPT ); Thu, 5 Nov 2015 14:21:26 -0500 Date: Thu, 5 Nov 2015 21:17:36 +0100 From: Oleg Nesterov To: Andrew Morton , Dmitry Vyukov Cc: Roland McGrath , amanieu@gmail.com, pmoore@redhat.com, Ingo Molnar , vdavydov@parallels.com, qiaowei.ren@intel.com, dave@stgolabs.net, palmer@dabbelt.com, syzkaller , Kostya Serebryany , Alexander Potapenko , Sasha Levin , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] signal: change sig_task_ignored(force) to take sig_kernel_only() into account Message-ID: <20151105201736.GA15782@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151105201720.GA15763@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org sig_task_ignored(force => true) returns false unless sig_kernel_ignore(). This makes no sense if !sig_kernel_only(), the signal will be dropped in get_signal() anyway. This patch simplifies the next change and allows us to do more cleanups, in particular we can unify the SIGNAL_UNKILLABLE/sig_kernel_only() check in sig_task_ignored() and get_signal(). The user-visible change is that, since we drop the SIG_DFL signal early, it won't be reported to debugger. I think this is fine, but probably we will change this later, we need to fix this logic anyway. Currently we rely on the fact that (say) send_sigtrap() uses force_sig_info() which clears SIGNAL_UNKILLABLE, and this is really bad. Signed-off-by: Oleg Nesterov --- kernel/signal.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c index d64efad..87209e5 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -72,7 +72,7 @@ static int sig_task_ignored(struct task_struct *t, int sig, bool force) handler = sig_handler(t, sig); if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) && - handler == SIG_DFL && !force) + handler == SIG_DFL && !(force && sig_kernel_only(sig))) return 1; return sig_handler_ignored(handler, sig); -- 1.5.5.1