linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Save NVGPRS in 32-bit signal frame
@ 2005-11-24 12:51 David Woodhouse
  2005-11-24 17:36 ` David Woodhouse
  0 siblings, 1 reply; 2+ messages in thread
From: David Woodhouse @ 2005-11-24 12:51 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Somehow this one slipped through the cracks; when we ended up in
do_signal() on a 32-bit kernel but without having the caller-saved
registers into the regs, we didn't set the TIF_SAVE_NVGPRS flag to
ensure they got saved later.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>

diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -219,6 +218,15 @@ static inline int get_old_sigaction(stru
 static inline int save_general_regs(struct pt_regs *regs,
 		struct mcontext __user *frame)
 {
+	if (!FULL_REGS(regs)) {
+		/* Zero out the unsaved GPRs to avoid information
+		   leak, and set TIF_SAVE_NVGPRS to ensure that the
+		   registers do actually get saved later. */
+		memset(&regs->gpr[14], 0, 18 * sizeof(unsigned long));
+		current_thread_info()->nvgprs_frame = &frame->mc_gregs;
+		set_thread_flag(TIF_SAVE_NVGPRS);
+	}
+
 	return __copy_to_user(&frame->mc_gregs, regs, GP_REGS_SIZE);
 }
 

-- 
dwmw2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Save NVGPRS in 32-bit signal frame
  2005-11-24 12:51 [PATCH] Save NVGPRS in 32-bit signal frame David Woodhouse
@ 2005-11-24 17:36 ` David Woodhouse
  0 siblings, 0 replies; 2+ messages in thread
From: David Woodhouse @ 2005-11-24 17:36 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

On Thu, 2005-11-24 at 12:51 +0000, David Woodhouse wrote:
> Somehow this one slipped through the cracks; when we ended up in
> do_signal() on a 32-bit kernel but without having the caller-saved
> registers into the regs, we didn't set the TIF_SAVE_NVGPRS flag to
> ensure they got saved later.

Oh, and if we actually set the flag, then we fairly quickly find out
that I was a bit overzealous in copying code from entry_64.S ... :)

Signed-off-by: David Woodhouse <dwmw2@infradead.org>

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 8fed953..036b71d 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -368,7 +368,7 @@ save_user_nvgprs_cont:
 	b	6b
 
 save_user_nvgprs:
-	ld	r8,TI_SIGFRAME(r12)
+	lwz	r8,TI_SIGFRAME(r12)
 
 .macro savewords start, end
   1:	stw \start,4*(\start)(r8)
@@ -386,11 +386,11 @@ save_user_nvgprs:
 	
 save_user_nvgprs_fault:
 	li	r3,11		/* SIGSEGV */
-	ld	r4,TI_TASK(r12)
+	lwz	r4,TI_TASK(r12)
 	bl	force_sigsegv
 
 	rlwinm	r12,r1,0,0,(31-THREAD_SHIFT)	/* current_thread_info() */
-	ld	r9,TI_FLAGS(r12)
+	lwz	r9,TI_FLAGS(r12)
 	b	save_user_nvgprs_cont
 	
 #ifdef SHOW_SYSCALLS

-- 
dwmw2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-11-24 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-24 12:51 [PATCH] Save NVGPRS in 32-bit signal frame David Woodhouse
2005-11-24 17:36 ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).