public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Chris Wright <chrisw@osdl.org>
Cc: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
	Bodo Stroesser <bstroesser@fujitsu-siemens.com>,
	linux-kernel@vger.kernel.org, Robert Wilkens <robw@optonline.net>
Subject: [PATCH] Fix i386 signal handling of NODEFER, should not affect sa_mask (was: Re: Signal handling possibly wrong)
Date: Tue, 09 Aug 2005 17:00:23 -0400	[thread overview]
Message-ID: <1123621223.9553.4.camel@localhost.localdomain> (raw)
In-Reply-To: <20050809204928.GH7991@shell0.pdx.osdl.net>

On Tue, 2005-08-09 at 13:49 -0700, Chris Wright wrote:

> 
> SA_NODEFER
>     [XSI] If set and sig is caught, sig shall not be added to the thread's
>     signal mask on entry to the signal handler unless it is included in
>     sa_mask. Otherwise, sig shall always be added to the thread's signal
>     mask on entry to the signal handler.
> 
> Brodo, is this what you mean?
> 
> thanks,
> -chris
> --
> 
> Subject: [PATCH] fix SA_NODEFER signals to honor sa_mask
> 
> When receiving SA_NODEFER signal, kernel was inapproriately not applying
> the sa_mask.  As pointed out by Brodo Stroesser.
> 
> Signed-off-by: Chris Wright <chrisw@osdl.org>
> ---
> 
> diff --git a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c
> --- a/arch/i386/kernel/signal.c
> +++ b/arch/i386/kernel/signal.c
> @@ -577,13 +577,12 @@ handle_signal(unsigned long sig, siginfo
>  	else
>  		ret = setup_frame(sig, ka, oldset, regs);
>  
> -	if (ret && !(ka->sa.sa_flags & SA_NODEFER)) {
> -		spin_lock_irq(&current->sighand->siglock);
> -		sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
> +	spin_lock_irq(&current->sighand->siglock);
> +	sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
> +	if (ret && !(ka->sa.sa_flags & SA_NODEFER))
>  		sigaddset(&current->blocked,sig);
> -		recalc_sigpending();
> -		spin_unlock_irq(&current->sighand->siglock);
> -	}
> +	recalc_sigpending();
> +	spin_unlock_irq(&current->sighand->siglock);
>  
>  	return ret;
>  }


Hmm, I think you want this patch. You still need to check the return of
setting up the frames.

-- Steve

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

--- linux-2.6.13-rc6-git1/arch/i386/kernel/signal.c.orig	2005-08-09 16:54:36.000000000 -0400
+++ linux-2.6.13-rc6-git1/arch/i386/kernel/signal.c	2005-08-09 16:55:24.000000000 -0400
@@ -577,10 +577,11 @@ handle_signal(unsigned long sig, siginfo
 	else
 		ret = setup_frame(sig, ka, oldset, regs);
 
-	if (ret && !(ka->sa.sa_flags & SA_NODEFER)) {
+	if (ret) {
 		spin_lock_irq(&current->sighand->siglock);
 		sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
-		sigaddset(&current->blocked,sig);
+		if (!(ka->sa.sa_flags & SA_NODEFER))
+			sigaddset(&current->blocked,sig);
 		recalc_sigpending();
 		spin_unlock_irq(&current->sighand->siglock);
 	}



  reply	other threads:[~2005-08-09 21:00 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-09 17:44 Signal handling possibly wrong Bodo Stroesser
2005-08-09 18:26 ` Robert Wilkens
2005-08-09 18:32   ` Bodo Stroesser
2005-08-09 18:39     ` Robert Wilkens
2005-08-09 18:44       ` Bodo Stroesser
2005-08-09 19:04         ` Robert Wilkens
2005-08-09 19:33           ` Steven Rostedt
2005-08-09 19:41             ` Bodo Stroesser
2005-08-09 20:03               ` Steven Rostedt
2005-08-09 20:19                 ` Steven Rostedt
2005-08-09 20:49                   ` Chris Wright
2005-08-09 21:00                     ` Steven Rostedt [this message]
2005-08-09 21:06                       ` [PATCH] Fix i386 signal handling of NODEFER, should not affect sa_mask (was: Re: Signal handling possibly wrong) Chris Wright
2005-08-09 21:07                       ` [PATCH] Fix PPC signal handling of NODEFER, should not affect sa_mask Steven Rostedt
2005-08-09 21:27                         ` Linus Torvalds
2005-08-10  3:10                           ` Steven Rostedt
2005-08-10  3:33                             ` Steven Rostedt
2005-08-12 18:37                             ` Jan Engelhardt
2005-08-12 18:45                               ` Chris Wright
2005-08-12 18:59                                 ` Steven Rostedt
2005-08-12 19:27                                   ` Steven Rostedt
2005-08-12 19:31                                   ` Jesper Juhl
2005-08-12 21:08                                     ` Steven Rostedt
2005-08-14 11:24                                       ` Jesper Juhl
2005-08-12 21:53                                     ` Steven Rostedt
2005-08-14 22:04                                       ` Kyle Moffett
2005-08-13 18:47                                   ` Marc Ballarin
2005-08-10  9:44                           ` Bodo Stroesser
2005-08-09 21:04                     ` Signal handling possibly wrong Chris Wright
2005-08-10  9:11                     ` Bodo Stroesser
2005-08-10 16:20                       ` Chris Wright
2005-08-09 19:33           ` Jeremy Maitin-Shepard
2005-08-09 18:50 ` smbus driver for ati xpress 200m yhlu
2005-08-09 22:57   ` Andi Kleen
2005-08-10  2:51     ` yhlu
2005-08-10  7:27       ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1123621223.9553.4.camel@localhost.localdomain \
    --to=rostedt@goodmis.org \
    --cc=akpm@osdl.org \
    --cc=bstroesser@fujitsu-siemens.com \
    --cc=chrisw@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robw@optonline.net \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox