mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2.5.73] Fix sa_mask and SA_NODEFER semantics for i386
@ 2003-07-04 20:51 Jörn Engel
  0 siblings, 0 replies; only message in thread
From: Jörn Engel @ 2003-07-04 20:51 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: benh, linux-kernel, linuxppc-dev, linuxppc64-dev

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);
 }
 
 /*

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-07-04 20:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-04 20:51 [PATCH 2.5.73] Fix sa_mask and SA_NODEFER semantics for i386 Jörn Engel

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®