[parisc-linux-cvs] Fix 2 signal bugs

John Marvin jsm@udlkern.fc.hp.com
Tue, 12 Jun 2001 05:55:22 -0600 (MDT)


Oops, I blew it on the commit, and the following log entry didn't make it
into cvs:

Fix two signal bugs:

1) Give signal handler a clean PSW if it is being run while not in a
syscall. Previously the signal handler was run with whatever PSW was
in effect at the time the process was interrupted, which is bad if the
nullify bit was set (caused first instruction of signal handler to be 
nullified, which is the instruction which saves rp on the stack).

2) For alternate signal stacks, initialize sp to the beginning of the
alternate signal stack area, rather than the end, because stacks grow 
up on parisc.

Anyway, the diff for the above is below.

John

--- signal.c.old	Tue Jun 12 01:34:12 2001
+++ signal.c	Tue Jun 12 03:21:25 2001
@@ -227,7 +227,7 @@ static inline void *
 get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
 {
 	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp))
-		sp = current->sas_ss_sp + current->sas_ss_size;
+		sp = current->sas_ss_sp; /* Stacks grow up! */
 
 	return (void *) sp; /* Stacks grow up.  Fun. */
 }
@@ -359,6 +359,7 @@ setup_rt_frame(int sig, struct k_sigacti
 	if (in_syscall)
 		regs->gr[31] = (HACK) haddr;
 	else {
+		regs->gr[0] = USER_PSW;
 		regs->iaoq[0] = (HACK) haddr | 3;
 		regs->iaoq[1] = regs->iaoq[0] + 4;
 	}
@@ -380,7 +381,6 @@ setup_rt_frame(int sig, struct k_sigacti
 	       current->comm, current->pid, frame, regs->gr[30],
 	       regs->iaoq[0], regs->iaoq[1], rp);
 #endif
-
 	return 1;
 
 give_sigsegv:
@@ -440,6 +440,7 @@ handle_signal(unsigned long sig, struct 
  * registers).  As noted below, the syscall number gets restored for
  * us due to the magic of delayed branching.
  */
+
 asmlinkage int
 do_signal(sigset_t *oldset, struct pt_regs *regs, int in_syscall)
 {