From: Corey Minyard <minyard@acm.org>
To: linux-kernel@vger.kernel.org
Subject: Possible race in signal handling
Date: Wed, 10 Mar 2004 15:59:58 -0600 [thread overview]
Message-ID: <404F8FDE.3050305@acm.org> (raw)
I'm hoping I am wrong, but I think I have found a race in signal
handling. I believe this can only happen in an SMP system or a system
with preempt on. I'll use 2.6 for the example, but I think it applies
to 2.4, too.
In arch/i386/signal.c, in the do_signal() function, it calls
get_signal_to_deliver() which returns the signal number to deliver
(along with siginfo). get_signal_to_deliver() grabs and releases the
lock, so the signal handler lock is not held in do_signal(). Then the
do_signal() calls handle_signal(), which uses the signal number to
extract the sa_handler, etc.
Since no lock is held, it seems like another thread with the same signal
handler set can come in and call sigaction(), it can change sa_handler
between the call to get_signal_to_deliver() and fetching the value of
sa_handler. If the sigaction() call set it to SIG_IGN, SIG_DFL, or some
other fundamental change, that bad things can happen.
Am I correct here, or am I missing something?
-Corey
next reply other threads:[~2004-03-10 22:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-10 21:59 Corey Minyard [this message]
2004-03-13 2:07 ` Race in signal handling with reproducer program Corey Minyard
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=404F8FDE.3050305@acm.org \
--to=minyard@acm.org \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.