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 10/11] - UML - Don't delay segfaults
Date: Fri, 12 Nov 2004 21:01:01 -0500 [thread overview]
Message-ID: <200411130201.iAD211pT005896@ccure.user-mode-linux.org> (raw)
>From Bodo Stroesser - This one covers the fact, that the SIGSEGV
signal, which is created by force_sigsegv() in case of an error in
handle_signal(), is not delivered to the user immediately. In the
worst case it even could be masked if a sigprocmask() systemcall
follows immediately after return from kernel. The patch is relevant
for other architectures, too.
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:20.000000000 -0500
+++ 2.6.9/arch/um/kernel/signal_kern.c 2004-11-12 16:24:21.000000000 -0500
@@ -38,9 +38,9 @@
/*
* OK, we're invoking a handler
*/
-static void handle_signal(struct pt_regs *regs, unsigned long signr,
- struct k_sigaction *ka, siginfo_t *info,
- sigset_t *oldset)
+static int handle_signal(struct pt_regs *regs, unsigned long signr,
+ struct k_sigaction *ka, siginfo_t *info,
+ sigset_t *oldset)
{
unsigned long sp;
int err;
@@ -94,23 +94,25 @@
recalc_sigpending();
spin_unlock_irq(¤t->sighand->siglock);
}
+
+ return err;
}
static int kern_do_signal(struct pt_regs *regs, sigset_t *oldset)
{
struct k_sigaction ka_copy;
siginfo_t info;
- int sig;
+ int sig, handled_sig = 0;
- sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL);
- if(sig > 0){
+ while((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0){
+ handled_sig = 1;
/* Whee! Actually deliver the signal. */
- handle_signal(regs, sig, &ka_copy, &info, oldset);
- return(1);
+ if(!handle_signal(regs, sig, &ka_copy, &info, oldset))
+ break;
}
/* Did we come from a system call? */
- if(PT_REGS_SYSCALL_NR(regs) >= 0){
+ if(!handled_sig && (PT_REGS_SYSCALL_NR(regs) >= 0)){
/* Restart the system call - no handlers present */
if(PT_REGS_SYSCALL_RET(regs) == -ERESTARTNOHAND ||
PT_REGS_SYSCALL_RET(regs) == -ERESTARTSYS ||
@@ -134,7 +136,7 @@
if(current->ptrace & PT_DTRACE)
current->thread.singlestep_syscall =
is_syscall(PT_REGS_IP(¤t->thread.regs));
- return(0);
+ return(handled_sig);
}
int do_signal(void)
reply other threads:[~2004-11-12 23:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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.iAD211pT005896@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome