linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -mm 1/4] powerpc copy_siginfo_from_user32
@ 2008-03-13  8:31 Roland McGrath
  2008-03-13  8:32 ` [PATCH -mm 2/4] ptrace: compat_ptrace_request siginfo Roland McGrath
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Roland McGrath @ 2008-03-13  8:31 UTC (permalink / raw)
  To: Paul Mackerras, Anton Blanchard
  Cc: linuxppc-dev, Ingo Molnar, Thomas Gleixner, Andrew Morton,
	linux-kernel


Define the copy_siginfo_from_user32 entry point for powerpc, so
that generic CONFIG_COMPAT code can call it.  We already had the
code rolled into compat_sys_rt_sigqueueinfo, this just moves it
out into the canonical function that other arch's define.

Signed-off-by: Roland McGrath <roland@redhat.com>
---
 arch/powerpc/kernel/signal_32.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index d840bc7..ad69434 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -621,6 +621,18 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *d, siginfo_t *s)
 
 #define copy_siginfo_to_user	copy_siginfo_to_user32
 
+int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from)
+{
+	memset(to, 0, sizeof *to);
+
+	if (copy_from_user(to, from, 3*sizeof(int)) ||
+	    copy_from_user(to->_sifields._pad,
+			   from->_sifields._pad, SI_PAD_SIZE32))
+		return -EFAULT;
+
+	return 0;
+}
+
 /*
  * Note: it is necessary to treat pid and sig as unsigned ints, with the
  * corresponding cast to a signed int to insure that the proper conversion
@@ -634,9 +646,10 @@ long compat_sys_rt_sigqueueinfo(u32 pid, u32 sig, compat_siginfo_t __user *uinfo
 	int ret;
 	mm_segment_t old_fs = get_fs();
 
-	if (copy_from_user (&info, uinfo, 3*sizeof(int)) ||
-	    copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE32))
-		return -EFAULT;
+	ret = copy_siginfo_from_user32(&info, uinfo);
+	if (unlikely(ret))
+		return ret;
+
 	set_fs (KERNEL_DS);
 	/* The __user pointer cast is valid becasuse of the set_fs() */
 	ret = sys_rt_sigqueueinfo((int)pid, (int)sig, (siginfo_t __user *) &info);

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

end of thread, other threads:[~2008-03-13 23:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-13  8:31 [PATCH -mm 1/4] powerpc copy_siginfo_from_user32 Roland McGrath
2008-03-13  8:32 ` [PATCH -mm 2/4] ptrace: compat_ptrace_request siginfo Roland McGrath
2008-03-13 14:42   ` Jeff Dike
2008-03-13  8:33 ` [PATCH -mm 3/4] x86_64 ia32 ptrace: use compat_ptrace_request for siginfo Roland McGrath
2008-03-13  8:34 ` [PATCH -mm 4/4] x86_64 ia32 ptrace: convert to compat_arch_ptrace Roland McGrath
2008-03-13 21:35 ` [PATCH -mm 1/4] powerpc copy_siginfo_from_user32 Andrew Morton
2008-03-13 23:36   ` Roland McGrath

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).