mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Davide Libenzi <davidel@xmailserver.org>
To: Andries Brouwer <aebr@win.tue.nl>
Cc: Steve G <linux_4ever@yahoo.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: 2.6.x signal handler bug
Date: Sun, 27 Jun 2004 15:45:23 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.58.0406271539340.19865@bigblue.dev.mdolabs.com> (raw)
In-Reply-To: <20040627221612.GA16664@pclin040.win.tue.nl>

On Mon, 28 Jun 2004, Andries Brouwer wrote:

> On Sat, Jun 26, 2004 at 09:05:34AM -0700, Davide Libenzi wrote:
> 
> > You're receiving a SIGSEGV while SIGSEGV is blocked (force_sig_info). The 
> > force_sig_info call wants to send a signal that the task can't refuse 
> > (kinda The GodFather offers ;). The kernel will noticed this and will 
> > restore the handler to SIG_DFL.
> 
> Yes.
> 
> So checking whether this is POSIX conforming:
> 
> - Blocking a signal in its signal handler is explicitly allowed.
>   (signal(3p))
> - It is unspecified what longjmp() does with the signal mask.
>   (longjmp(3p))
> - The SIGSEGV that occurs during a stack overflow is of the GodFather kind.
>   (getrlimit(3p))
> - If SIGSEGV is generated while blocked, the result is undefined
>   (sigprocmask(3p))
> 
> So, maybe the restoring to SIG_DFL was not required, but it doesnt seem
> incorrect either. It may be a bit surprising.

I think so. Maybe the attached patch?



- Davide




--- a/kernel/signal.c	2004-06-27 15:42:26.000000000 -0700
+++ b/kernel/signal.c	2004-06-27 15:43:28.000000000 -0700
@@ -820,8 +820,9 @@
 	int ret;
 
 	spin_lock_irqsave(&t->sighand->siglock, flags);
-	if (sigismember(&t->blocked, sig) || t->sighand->action[sig-1].sa.sa_handler == SIG_IGN) {
-		t->sighand->action[sig-1].sa.sa_handler = SIG_DFL;
+	if (sigismember(&t->blocked, sig)) {
+		if (t->sighand->action[sig-1].sa.sa_handler == SIG_IGN)
+			t->sighand->action[sig-1].sa.sa_handler = SIG_DFL;
 		sigdelset(&t->blocked, sig);
 		recalc_sigpending_tsk(t);
 	}

  reply	other threads:[~2004-06-27 22:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-26 14:33 Steve G
2004-06-26 16:05 ` Davide Libenzi
2004-06-27 22:16   ` Andries Brouwer
2004-06-27 22:45     ` Davide Libenzi [this message]
2004-06-27 22:51       ` Davide Libenzi
2004-06-28  2:01         ` Steve G
2004-06-28 11:26         ` Steve G
2004-06-28 14:56           ` Davide Libenzi
  -- strict thread matches above, loose matches on Subject: below --
2004-06-25 23:56 Paul Maurides
2004-06-26  0:07 ` Andrew Morton
2004-06-26  1:33 ` David Wagner
2004-06-28 21:56 ` Jörn Engel

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=Pine.LNX.4.58.0406271539340.19865@bigblue.dev.mdolabs.com \
    --to=davidel@xmailserver.org \
    --cc=aebr@win.tue.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_4ever@yahoo.com \
    /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

all inboxes | Powered by JetHome®