From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754523Ab1DKRWp (ORCPT ); Mon, 11 Apr 2011 13:22:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16828 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753450Ab1DKRWo (ORCPT ); Mon, 11 Apr 2011 13:22:44 -0400 Date: Mon, 11 Apr 2011 19:22:01 +0200 From: Oleg Nesterov To: Tejun Heo , Linus Torvalds , Andrew Morton Cc: "Nikita V. Youshchenko" , Matt Fleming , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH 5/6] x86: signal: handle_signal() should use sigprocmask() Message-ID: <20110411172201.GF32469@redhat.com> References: <20110411171957.GA32469@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110411171957.GA32469@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 This is ugly, but if sigprocmask() needs retarget_shared_pending() then handle signal should follow this logic. In theory it is newer correct to add the new signals to current->blocked, the signal handler can sleep/etc so we should notify other threads in case we block the pending signal and nobody else has TIF_SIGPENDING. Of course, this change doesn't make signals faster :/ Signed-off-by: Oleg Nesterov --- arch/x86/kernel/signal.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- sigprocmask/arch/x86/kernel/signal.c~5_handle_signal 2011-04-06 21:33:43.000000000 +0200 +++ sigprocmask/arch/x86/kernel/signal.c 2011-04-11 18:33:17.000000000 +0200 @@ -682,6 +682,7 @@ static int handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, sigset_t *oldset, struct pt_regs *regs) { + sigset_t blocked; int ret; /* Are we from a system call? */ @@ -741,12 +742,10 @@ handle_signal(unsigned long sig, siginfo */ regs->flags &= ~X86_EFLAGS_TF; - spin_lock_irq(¤t->sighand->siglock); - sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); + blocked = ka->sa.sa_mask; if (!(ka->sa.sa_flags & SA_NODEFER)) - sigaddset(¤t->blocked, sig); - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); + sigaddset(&blocked, sig); + sigprocmask(SIG_BLOCK, &blocked, NULL); tracehook_signal_handler(sig, info, ka, regs, test_thread_flag(TIF_SINGLESTEP));