[PATCH 2.5.73] Fix sa_mask and SA_NODEFER semantics for i386

From: Jörn Engel (joern@wohnheim.fh-wedel.de)
Date: Fri Jul 04 2003 - 15:51:26 EST


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); } /* - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 07 2003 - 22:00:24 EST