mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: benh@kernel.crashing.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.linuxppc.org,
	linuxppc64-dev@lists.linuxppc.org
Subject: [PATCH 2.5.73] Fix sa_mask and SA_NODEFER semantics for i386
Date: Fri, 4 Jul 2003 22:51:26 +0200	[thread overview]
Message-ID: <20030704205126.GA8196@wohnheim.fh-wedel.de> (raw)

Hi Linus!

This patch should be less to argue about.

A trivial case where code and documentation don't match.  This is from
man 3 sigaction:

     sa_mask gives a mask of signals which should be blocked  during execu-
     tion  of  the  signal handler.  In addition, the signal which triggered
     the handler will be blocked, unless the SA_NODEFER or  SA_NOMASK  flags
     are used.

In other words:
- Always block the signals from sa_mask.
- Also block the current signal, if SA_NODEFER is not set.

But without this patch, linux ignores sa_mask, when SA_NODEFER is set,
so either the documentation or our implementation is wrong.  Since the
bsd manpage matches the linux one, I guess the code is wrong.

Jörn

-- 
Everything should be made as simple as possible, but not simpler.
-- Albert Einstein

--- linux-2.5.73/arch/i386/kernel/signal.c~sigmask_i386	2003-07-04 18:59:48.000000000 +0200
+++ linux-2.5.73/arch/i386/kernel/signal.c	2003-07-04 22:39:59.000000000 +0200
@@ -551,13 +551,12 @@
 	if (ka->sa.sa_flags & SA_ONESHOT)
 		ka->sa.sa_handler = SIG_DFL;
 
-	if (!(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 (!(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);
 }
 
 /*

                 reply	other threads:[~2003-07-04 20:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20030704205126.GA8196@wohnheim.fh-wedel.de \
    --to=joern@wohnheim.fh-wedel.de \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.linuxppc.org \
    --cc=linuxppc64-dev@lists.linuxppc.org \
    --cc=torvalds@transmeta.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®