Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Giuseppe Sacco <giuseppe@eppesuigoccas.homedns.org>
Cc: linux-mips@linux-mips.org
Subject: Re: undefined reference to `copy_siginfo_from_user32'
Date: Tue, 29 Apr 2008 11:00:39 +0200	[thread overview]
Message-ID: <20080429090039.GA16616@lst.de> (raw)
In-Reply-To: <20080428212327.47c703b6.giuseppe@eppesuigoccas.homedns.org>

On Mon, Apr 28, 2008 at 09:23:27PM +0200, Giuseppe Sacco wrote:
> Hi list,
> since a few days, whenever I try to recompile the latest kernel (from git) it always print this error message:

This should be fixed in mainline.  But the right fix would be to switch
mips to the generic compat_ptrace.  And untested (and in fact even
uncompiled) patch ontop of the copy_siginfo_to_user32 posted to the list
a while ago is below to sketch how this should look like:


Index: linux-2.6/arch/mips/kernel/ptrace32.c
===================================================================
--- linux-2.6.orig/arch/mips/kernel/ptrace32.c	2008-04-29 10:54:44.000000000 +0200
+++ linux-2.6/arch/mips/kernel/ptrace32.c	2008-04-29 10:59:17.000000000 +0200
@@ -42,56 +42,17 @@ int ptrace_setregs(struct task_struct *c
 int ptrace_getfpregs(struct task_struct *child, __u32 __user *data);
 int ptrace_setfpregs(struct task_struct *child, __u32 __user *data);
 
+
 /*
  * Tracing a 32-bit process with a 64-bit strace and vice versa will not
  * work.  I don't know how to fix this.
  */
-asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
+long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
+			compat_ulong_t addr, compat_ulong_t data)
 {
-	struct task_struct *child;
 	int ret;
 
-#if 0
-	printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n",
-	       (int) request, (int) pid, (unsigned long) addr,
-	       (unsigned long) data);
-#endif
-	lock_kernel();
-	if (request == PTRACE_TRACEME) {
-		ret = ptrace_traceme();
-		goto out;
-	}
-
-	child = ptrace_get_task_struct(pid);
-	if (IS_ERR(child)) {
-		ret = PTR_ERR(child);
-		goto out;
-	}
-
-	if (request == PTRACE_ATTACH) {
-		ret = ptrace_attach(child);
-		goto out_tsk;
-	}
-
-	ret = ptrace_check_attach(child, request == PTRACE_KILL);
-	if (ret < 0)
-		goto out_tsk;
-
 	switch (request) {
-	/* when I and D space are separate, these will need to be fixed. */
-	case PTRACE_PEEKTEXT: /* read word at location addr. */
-	case PTRACE_PEEKDATA: {
-		unsigned int tmp;
-		int copied;
-
-		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
-		ret = -EIO;
-		if (copied != sizeof(tmp))
-			break;
-		ret = put_user(tmp, (unsigned int __user *) (unsigned long) data);
-		break;
-	}
-
 	/*
 	 * Read 4 bytes of the other process' storage
 	 *  data is a pointer specifying where the user wants the
@@ -237,16 +198,6 @@ asmlinkage int sys32_ptrace(int request,
 		break;
 	}
 
-	/* when I and D space are separate, this will have to be fixed. */
-	case PTRACE_POKETEXT: /* write the word at location addr. */
-	case PTRACE_POKEDATA:
-		ret = 0;
-		if (access_process_vm(child, addr, &data, sizeof(data), 1)
-		    == sizeof(data))
-			break;
-		ret = -EIO;
-		break;
-
 	/*
 	 * Write 4 bytes into the other process' storage
 	 *  data is the 4 bytes that the user wants written
@@ -400,24 +351,15 @@ asmlinkage int sys32_ptrace(int request,
 		ret = ptrace_detach(child, data);
 		break;
 
-	case PTRACE_GETEVENTMSG:
-		ret = put_user(child->ptrace_message,
-			       (unsigned int __user *) (unsigned long) data);
-		break;
-
 	case PTRACE_GET_THREAD_AREA_3264:
 		ret = put_user(task_thread_info(child)->tp_value,
 				(unsigned long __user *) (unsigned long) data);
 		break;
 
 	default:
-		ret = ptrace_request(child, request, addr, data);
+		ret = compat_ptrace_request(child, request, addr, data);
 		break;
 	}
 
-out_tsk:
-	put_task_struct(child);
-out:
-	unlock_kernel();
 	return ret;
 }
Index: linux-2.6/include/asm-mips/ptrace.h
===================================================================
--- linux-2.6.orig/include/asm-mips/ptrace.h	2008-04-29 11:00:10.000000000 +0200
+++ linux-2.6/include/asm-mips/ptrace.h	2008-04-29 11:00:19.000000000 +0200
@@ -76,6 +76,8 @@ struct pt_regs {
 #include <linux/linkage.h>
 #include <asm/isadep.h>
 
+#define __ARCH_WANT_COMPAT_SYS_PTRACE
+
 /*
  * Does the process account for user or for system time?
  */

  reply	other threads:[~2008-04-29  9:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-28 19:23 undefined reference to `copy_siginfo_from_user32' Giuseppe Sacco
2008-04-29  9:00 ` Christoph Hellwig [this message]
2008-05-01 18:11   ` Giuseppe Sacco
2008-05-11  6:31     ` Christoph Hellwig

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=20080429090039.GA16616@lst.de \
    --to=hch@lst.de \
    --cc=giuseppe@eppesuigoccas.homedns.org \
    --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