From: Andreas Schwab <schwab@suse.de>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] Bug in signal handling
Date: Sun, 02 Dec 2001 22:05:29 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590698805573@msgid-missing> (raw)
The kernel does not correctly handle interrupted syscalls that are
supposed to be restarted when two nested signal handlers are executed at
the same time. To reproduce run this program in one terminal:
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <string.h>
void
sigusr1 (int sig)
{
write (2, "SIGUSR1\n", strlen ("SIGUSR1\n"));
}
void
sigusr2 (int sig)
{
write (2, "SIGUSR2\n", strlen ("SIGUSR2\n"));
}
int
main ()
{
char c;
struct sigaction sa;
printf ("%d\n", getpid ());
sa.sa_handler = sigusr1;
sigemptyset (&sa.sa_mask);
sa.sa_flags = SA_RESTART;
sigaction (SIGUSR1, &sa, NULL);
sa.sa_handler = sigusr2;
sigaction (SIGUSR2, &sa, NULL);
read (1, &c, 1);
return 0;
}
Then send both SIGUSR1 and SIGUSR2 to the process from another terminal.
If they arrive close enough then the first signal handler will be
interupted at GATE_ADDR by the second handler. But ia64_do_signal is
again called with in_syscall == 1, and it will call ia64_decrement_ip
before setting up the signal handler frame. Thus when the second signal
returns then rt_sigreturn it will return to GATE_ADDR - 16 and crashes.
Andreas.
--
Andreas Schwab "And now for something
Andreas.Schwab@suse.de completely different."
SuSE Labs, SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
next reply other threads:[~2001-12-02 22:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-02 22:05 Andreas Schwab [this message]
2001-12-03 3:15 ` [Linux-ia64] Bug in signal handling David Mosberger
2001-12-04 19:53 ` David Mosberger
2001-12-05 1:14 ` Richard Henderson
2001-12-05 2:15 ` David Mosberger
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=marc-linux-ia64-105590698805573@msgid-missing \
--to=schwab@suse.de \
--cc=linux-ia64@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox