mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* mips ptrace compat build error
@ 2008-04-23 16:06 Adrian Bunk
  2008-04-28  7:01 ` Roland McGrath
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2008-04-23 16:06 UTC (permalink / raw)
  To: Roland McGrath, ralf; +Cc: linux-mips, linux-kernel

Commit e16b27816462de700f9508d86954410c41105dc2
(ptrace: compat_ptrace_request siginfo) causes
the following build error with CONFIG_COMPAT=y
on mips:

<--  snip   -->

...
  LD      .tmp_vmlinux1
kernel/built-in.o: In function `$L181':
ptrace.c:(.text+0x1d380): undefined reference to `copy_siginfo_from_user32'
ptrace.c:(.text+0x1d380): relocation truncated to fit: R_MIPS_26 against `copy_siginfo_from_user32'
make[1]: *** [.tmp_vmlinux1] Error 1

<--  snip  -->

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: mips ptrace compat build error
  2008-04-23 16:06 mips ptrace compat build error Adrian Bunk
@ 2008-04-28  7:01 ` Roland McGrath
  0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2008-04-28  7:01 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: ralf, linux-mips, linux-kernel

Sorry for the delay; I was out sick last week.

I thought I'd checked for other arch's that would be affected, but I think
I may only have noticed those that actually use compat_ptrace_request.
Every CONFIG_COMPAT arch ought to clean up to use compat_ptrace_request
anyway, replacing calls to ptrace_request or their own implementations of
things like PTRACE_GETEVENTMSG that compat_ptrace_request takes care of.

I'm not in a position to test mips, but this patch is probably what you
need to restore the build.  I'd recommend that you follow this up with a
cleanup patch to use compat_ptrace_request, and another to replace
sys32_ptrace with compat_arch_ptrace and set __ARCH_WANT_COMPAT_SYS_PTRACE.


Thanks,
Roland


diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 572c610..99372f7 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -775,14 +775,25 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *uset,
 	return ret;
 }
 
+int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __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_SIZE))
+		return -EFAULT;
+
+	return 0;
+}
+
 asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
 {
 	siginfo_t info;
 	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_SIZE))
+	if (copy_siginfo_from_user32(&info, uinfo))
 		return -EFAULT;
 	set_fs(KERNEL_DS);
 	ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *)&info);

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

end of thread, other threads:[~2008-04-28  7:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-23 16:06 mips ptrace compat build error Adrian Bunk
2008-04-28  7:01 ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®