linux-parisc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 25/40] parisc: Use set_current_blocked() and block_sigmask()
       [not found] <1329219673-28711-1-git-send-email-matt@console-pimps.org>
@ 2012-02-14 11:40 ` Matt Fleming
  2012-04-06 14:59   ` Kyle McMartin
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Fleming @ 2012-02-14 11:40 UTC (permalink / raw)
  To: linux-arch
  Cc: Oleg Nesterov, Andrew Morton, linux-kernel, Matt Fleming,
	Kyle McMartin, Helge Deller, James E.J. Bottomley, linux-parisc

From: Matt Fleming <matt.fleming@intel.com>

As described in e6fa16ab ("signal: sigprocmask() should do
retarget_shared_pending()") the modification of current->blocked is
incorrect as we need to check whether the signal we're about to block
is pending in the shared queue.

Also, use the new helper function introduced in commit 5e6292c0f28f
("signal: add block_sigmask() for adding sigmask to current->blocked")
which centralises the code for updating current->blocked after
successfully delivering a signal and reduces the amount of duplicate
code across architectures. In the past some architectures got this
code wrong, so using this helper function should stop that from
happening again.

Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Helge Deller <deller@gmx.de>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: linux-parisc@vger.kernel.org
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
---
 arch/parisc/kernel/signal.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index 12c1ed3..bd36152 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -131,10 +131,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
 	}
 		
 	sigdelsetmask(&set, ~_BLOCKABLE);
-	spin_lock_irq(&current->sighand->siglock);
-	current->blocked = set;
-	recalc_sigpending();
-	spin_unlock_irq(&current->sighand->siglock);
+	set_current_blocked(&set);
 
 	/* Good thing we saved the old gr[30], eh? */
 #ifdef CONFIG_64BIT
@@ -454,12 +451,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
 	if (!setup_rt_frame(sig, ka, info, oldset, regs, in_syscall))
 		return 0;
 
-	spin_lock_irq(&current->sighand->siglock);
-	sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
-	if (!(ka->sa.sa_flags & SA_NODEFER))
-		sigaddset(&current->blocked,sig);
-	recalc_sigpending();
-	spin_unlock_irq(&current->sighand->siglock);
+	block_sigmask(ka, sig);
 
 	tracehook_signal_handler(sig, info, ka, regs, 
 		test_thread_flag(TIF_SINGLESTEP) ||
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 25/40] parisc: Use set_current_blocked() and block_sigmask()
  2012-02-14 11:40 ` [PATCH 25/40] parisc: Use set_current_blocked() and block_sigmask() Matt Fleming
@ 2012-04-06 14:59   ` Kyle McMartin
  0 siblings, 0 replies; 2+ messages in thread
From: Kyle McMartin @ 2012-04-06 14:59 UTC (permalink / raw)
  To: Matt Fleming
  Cc: linux-arch, Oleg Nesterov, Andrew Morton, linux-kernel,
	Matt Fleming, Helge Deller, James E.J. Bottomley, linux-parisc

On Tue, Feb 14, 2012 at 11:40:58AM +0000, Matt Fleming wrote:
> From: Matt Fleming <matt.fleming@intel.com>
> 
> As described in e6fa16ab ("signal: sigprocmask() should do
> retarget_shared_pending()") the modification of current->blocked is
> incorrect as we need to check whether the signal we're about to block
> is pending in the shared queue.
> 
> Also, use the new helper function introduced in commit 5e6292c0f28f
> ("signal: add block_sigmask() for adding sigmask to current->blocked")
> which centralises the code for updating current->blocked after
> successfully delivering a signal and reduces the amount of duplicate
> code across architectures. In the past some architectures got this
> code wrong, so using this helper function should stop that from
> happening again.
> 
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: Kyle McMartin <kyle@mcmartin.ca>
> Cc: Helge Deller <deller@gmx.de>
> Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
> Cc: linux-parisc@vger.kernel.org
> Signed-off-by: Matt Fleming <matt.fleming@intel.com>

Nice cleanups Matt!

Acked-by: Kyle McMartin <kyle@mcmartin.ca>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-06 14:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1329219673-28711-1-git-send-email-matt@console-pimps.org>
2012-02-14 11:40 ` [PATCH 25/40] parisc: Use set_current_blocked() and block_sigmask() Matt Fleming
2012-04-06 14:59   ` Kyle McMartin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).