From: Jeff Dike <jdike@addtoit.com>
To: akpm@osdl.org, Blaisorblade <blaisorblade_spam@yahoo.it>,
Bodo Stroesser <bstroesser@fujitsu-siemens.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 9/11] - UML - fix signal mask on delivery error
Date: Fri, 12 Nov 2004 21:01:00 -0500 [thread overview]
Message-ID: <200411130201.iAD210pT005889@ccure.user-mode-linux.org> (raw)
>From Bodo Stroesser - If the user stack limit is reached or the
signal stack assigned with sigaltstack() is invalid when a user signal
handler with SA_ONSTACK has to be started, the signal mask of the
interrupted user program is modified. This happens because the mask,
that should be used with the handler only, is written to
"current->blocked" even if the handler could not be started. But
without a handler, no rewrite of the original mask at sys_sigreturn
will be done. A slightly different case is sys_sigsuspend(), where the
mask is already modified when kern_do_signal() is started. "*oldset" and
"current->blocked" are not equal here and thus current->blocked has to
be set to *oldset, if an error occurs in handle_signal().
For both cases I've written small tests, and with the patch the result
is OK.
This issue is relevant for other architectures too (e.g. i386, I've
seen).
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Index: 2.6.9/arch/um/kernel/signal_kern.c
===================================================================
--- 2.6.9.orig/arch/um/kernel/signal_kern.c 2004-11-12 16:24:18.000000000 -0500
+++ 2.6.9/arch/um/kernel/signal_kern.c 2004-11-12 18:05:26.000000000 -0500
@@ -79,7 +79,14 @@
else
err = setup_signal_stack_sc(sp, signr, ka, regs, oldset);
- if (!err && !(ka->sa.sa_flags & SA_NODEFER)) {
+ if(err){
+ spin_lock_irq(¤t->sighand->siglock);
+ current->blocked = *oldset;
+ recalc_sigpending();
+ spin_unlock_irq(¤t->sighand->siglock);
+ force_sigsegv(signr, current);
+ }
+ else if(!(ka->sa.sa_flags & SA_NODEFER)){
spin_lock_irq(¤t->sighand->siglock);
sigorsets(¤t->blocked, ¤t->blocked,
&ka->sa.sa_mask);
@@ -87,9 +94,6 @@
recalc_sigpending();
spin_unlock_irq(¤t->sighand->siglock);
}
-
- if(err)
- force_sigsegv(signr, current);
}
static int kern_do_signal(struct pt_regs *regs, sigset_t *oldset)
next reply other threads:[~2004-11-12 23:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-13 2:01 Jeff Dike [this message]
2004-11-13 0:34 ` [PATCH 9/11] - UML - fix signal mask on delivery error Andrew Morton
2004-11-14 22:13 ` Jeff Dike
2004-11-15 8:35 ` David Woodhouse
2004-11-22 15:30 ` David Woodhouse
2004-11-15 11:40 ` Bodo Stroesser
2004-11-15 17:18 ` Jeff Dike
2004-11-16 9:39 ` Bodo Stroesser
2004-11-30 14:59 ` David Woodhouse
2004-12-02 9:55 ` Bodo Stroesser
2004-12-02 11:25 ` Paul Mackerras
2004-12-02 11:40 ` Bodo Stroesser
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=200411130201.iAD210pT005889@ccure.user-mode-linux.org \
--to=jdike@addtoit.com \
--cc=akpm@osdl.org \
--cc=blaisorblade_spam@yahoo.it \
--cc=bstroesser@fujitsu-siemens.com \
--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.