Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: "Kip Walker" <kwalker@broadcom.com>
To: linux-mips@linux-mips.org
Subject: [patch] mips, mips64 signal trampoline
Date: Fri, 18 Oct 2002 08:19:10 -0700	[thread overview]
Message-ID: <3DB0266E.810D9D28@broadcom.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 396 bytes --]

It looks like the RA setup by setup_frame and setup_rt_frame in
arch/mips64/kernel/signal.c and signal32.c can be wrong.  Same for
arch/mips/kernel/signal.c

signal32.c, 32-bit signal.c: sa_restorer is overriden
signal.c: regs->regs[31] is pointed at the sigframe's code, even though
there isn't code in the frame, and a comment says that sa_restorer is
always used.

Patch for 2.4 attached.

Kip

[-- Attachment #2: signal.patch --]
[-- Type: text/plain, Size: 2845 bytes --]

Index: arch/mips64/kernel/signal.c
===================================================================
RCS file: /home/cvs/linux/arch/mips64/kernel/signal.c,v
retrieving revision 1.19.2.5
diff -u -r1.19.2.5 signal.c
--- arch/mips64/kernel/signal.c	18 Sep 2002 13:03:07 -0000	1.19.2.5
+++ arch/mips64/kernel/signal.c	18 Oct 2002 15:11:25 -0000
@@ -338,13 +338,12 @@
 	regs->regs[ 5] = 0;
 	regs->regs[ 6] = (unsigned long) &frame->sf_sc;
 	regs->regs[29] = (unsigned long) frame;
-	regs->regs[31] = (unsigned long) frame->sf_code;
 	regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler;
 
 #if DEBUG_SIG
 	printk("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n",
 	       current->comm, current->pid,
-	       frame, regs->cp0_epc, frame->sf_code);
+	       frame, regs->cp0_epc, regs->regs[31]);
 #endif
         return;
 
@@ -402,13 +401,12 @@
 	regs->regs[ 5] = (unsigned long) &frame->rs_info;
 	regs->regs[ 6] = (unsigned long) &frame->rs_uc;
 	regs->regs[29] = (unsigned long) frame;
-	regs->regs[31] = (unsigned long) frame->rs_code;
 	regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler;
 
 #if DEBUG_SIG
 	printk("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n",
 	       current->comm, current->pid,
-	       frame, regs->cp0_epc, frame->rs_code);
+	       frame, regs->cp0_epc, regs->regs[31]);
 #endif
 	return;
 
Index: arch/mips64/kernel/signal32.c
===================================================================
RCS file: /home/cvs/linux/arch/mips64/kernel/signal32.c,v
retrieving revision 1.20.2.9
diff -u -r1.20.2.9 signal32.c
--- arch/mips64/kernel/signal32.c	2 Oct 2002 12:21:45 -0000	1.20.2.9
+++ arch/mips64/kernel/signal32.c	18 Oct 2002 15:11:25 -0000
@@ -589,6 +589,7 @@
 		err |= __put_user(0x0000000c                 ,
 		                  frame->sf_code + 1);
 		flush_cache_sigtramp((unsigned long) frame->sf_code);
+		regs->regs[31] = (unsigned long) frame->sf_code;
 	}
 
 	err |= setup_sigcontext(regs, &frame->sf_sc);
@@ -610,7 +611,6 @@
 	regs->regs[ 5] = 0;
 	regs->regs[ 6] = (unsigned long) &frame->sf_sc;
 	regs->regs[29] = (unsigned long) frame;
-	regs->regs[31] = (unsigned long) frame->sf_code;
 	regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler;
 
 #if DEBUG_SIG
@@ -653,6 +653,7 @@
 		err |= __put_user(0x0000000c                 ,
 		                  frame->rs_code + 1);
 		flush_cache_sigtramp((unsigned long) frame->rs_code);
+		regs->regs[31] = (unsigned long) frame->rs_code;
 	}
 
 	/* Convert (siginfo_t -> siginfo_t32) and copy to user. */
@@ -687,7 +688,6 @@
 	regs->regs[ 5] = (unsigned long) &frame->rs_info;
 	regs->regs[ 6] = (unsigned long) &frame->rs_uc;
 	regs->regs[29] = (unsigned long) frame;
-	regs->regs[31] = (unsigned long) frame->rs_code;
 	regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler;
 
 #if DEBUG_SIG

             reply	other threads:[~2002-10-18 15:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-18 15:19 Kip Walker [this message]
2002-10-18 15:57 ` [patch] mips, mips64 signal trampoline Kip Walker

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=3DB0266E.810D9D28@broadcom.com \
    --to=kwalker@broadcom.com \
    --cc=linux-mips@linux-mips.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