[PATCH][2.6.8-rc2-mm1] s390 signal handling fixes

From: Mikael Pettersson
Date: Wed Jul 28 2004 - 16:57:10 EST


The signal-race-fixes patch in 2.6.8-rc2-mm1 appears to
be a bit broken on s390.

When forcing a SIGSEGV the old code updated "*ka", where
ka was a pointer to current's k_sigaction for SIGSEGV.
Now "ka_copy" points to a copy of that structure, so
assigning "*ka_copy" doesn't do what we want. Instead
do the assignment via current->... just like i386 and
x86_64 do.

Furthermore, the SA_ONESHOT handling wasn't deleted.
That is now handled by generic code in the kernel.

This patch has not been tested.

/Mikael Pettersson

diff -rupN linux-2.6.8-rc2-mm1/arch/s390/kernel/compat_signal.c linux-2.6.8-rc2-mm1.s390-signal-fixes/arch/s390/kernel/compat_signal.c
--- linux-2.6.8-rc2-mm1/arch/s390/kernel/compat_signal.c 2004-07-28 18:51:59.000000000 +0200
+++ linux-2.6.8-rc2-mm1.s390-signal-fixes/arch/s390/kernel/compat_signal.c 2004-07-28 23:41:47.397133944 +0200
@@ -506,7 +506,7 @@ static void setup_frame32(int sig, struc

give_sigsegv:
if (sig == SIGSEGV)
- ka_copy->sa.sa_handler = SIG_DFL;
+ current->sighand->action[sig-1].sa.sa_handler = SIG_DFL;
force_sig(SIGSEGV, current);
}

@@ -559,7 +559,7 @@ static void setup_rt_frame32(int sig, st

give_sigsegv:
if (sig == SIGSEGV)
- ka_copy->sa.sa_handler = SIG_DFL;
+ current->sighand->action[sig-1].sa.sa_handler = SIG_DFL;
force_sig(SIGSEGV, current);
}

@@ -577,9 +577,6 @@ handle_signal32(unsigned long sig, struc
else
setup_frame32(sig, ka_copy, oldset, regs);

- if (ka_copy->sa.sa_flags & SA_ONESHOT)
- ka_copy->sa.sa_handler = SIG_DFL;
-
if (!(ka_copy->sa.sa_flags & SA_NODEFER)) {
spin_lock_irq(&current->sighand->siglock);
sigorsets(&current->blocked,&current->blocked,
diff -rupN linux-2.6.8-rc2-mm1/arch/s390/kernel/signal.c linux-2.6.8-rc2-mm1.s390-signal-fixes/arch/s390/kernel/signal.c
--- linux-2.6.8-rc2-mm1/arch/s390/kernel/signal.c 2004-07-28 18:51:59.000000000 +0200
+++ linux-2.6.8-rc2-mm1.s390-signal-fixes/arch/s390/kernel/signal.c 2004-07-28 23:41:47.397133944 +0200
@@ -359,7 +359,7 @@ static void setup_frame(int sig, struct

give_sigsegv:
if (sig == SIGSEGV)
- ka_copy->sa.sa_handler = SIG_DFL;
+ current->sighand->action[sig-1].sa.sa_handler = SIG_DFL;
force_sig(SIGSEGV, current);
}

@@ -415,7 +415,7 @@ static void setup_rt_frame(int sig, stru

give_sigsegv:
if (sig == SIGSEGV)
- ka_copy->sa.sa_handler = SIG_DFL;
+ current->sighand->action[sig-1].sa.sa_handler = SIG_DFL;
force_sig(SIGSEGV, current);
}

@@ -433,9 +433,6 @@ handle_signal(unsigned long sig, struct
else
setup_frame(sig, ka_copy, oldset, regs);

- if (ka_copy->sa.sa_flags & SA_ONESHOT)
- ka_copy->sa.sa_handler = SIG_DFL;
-
if (!(ka_copy->sa.sa_flags & SA_NODEFER)) {
spin_lock_irq(&current->sighand->siglock);
sigorsets(&current->blocked,&current->blocked,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/