Below is the first step in your Fix-Your-Broken-Arch-HOWTO for UML.
Do you want incremental patches as I go along, or replacement ones?
BTW, UML runs on the utrace in -mm (i.e. utrace on the host), which it
didn't with several Fedora kernels.
Jeff
--
Work email - jdike at linux dot intel dot com
The first step in making the utrace arch changes for UML. It builds
and runs now, but ptrace is broken.
Signed-off-by: Jeff Dike <[EMAIL PROTECTED]>
--
arch/um/kernel/exec.c |1
arch/um/kernel/process.c|6
arch/um/kernel/ptrace.c | 333 +---
arch/um/kernel/signal.c |5
arch/um/kernel/skas/syscall.c |4
arch/um/sys-i386/signal.c |4
include/asm-um/ptrace-generic.h |3
include/asm-um/tracehook.h | 66 +++
8 files changed, 115 insertions(+), 307 deletions(-)
Index: linux-2.6.18-mm/arch/um/kernel/exec.c
===
--- linux-2.6.18-mm.orig/arch/um/kernel/exec.c 2007-02-20 16:18:07.0
-0500
+++ linux-2.6.18-mm/arch/um/kernel/exec.c 2007-02-20 16:18:50.0
-0500
@@ -51,7 +51,6 @@ static long execve1(char *file, char __u
error = do_execve(file, argv, env, ¤t->thread.regs);
if (error == 0){
task_lock(current);
-current->ptrace &= ~PT_DTRACE;
#ifdef SUBARCH_EXECVE1
SUBARCH_EXECVE1(¤t->thread.regs.regs);
#endif
Index: linux-2.6.18-mm/arch/um/kernel/process.c
===
--- linux-2.6.18-mm.orig/arch/um/kernel/process.c 2007-02-20
16:18:07.0 -0500
+++ linux-2.6.18-mm/arch/um/kernel/process.c2007-02-20 16:18:50.0
-0500
@@ -458,11 +458,11 @@ int singlestepping(void * t)
{
struct task_struct *task = t ? t : current;
- if ( ! (task->ptrace & PT_DTRACE) )
- return(0);
+ if (!test_thread_flag(TIF_SINGLESTEP))
+ return 0;
if (task->thread.singlestep_syscall)
- return(1);
+ return 1;
return 2;
}
Index: linux-2.6.18-mm/arch/um/kernel/ptrace.c
===
--- linux-2.6.18-mm.orig/arch/um/kernel/ptrace.c2007-02-20
16:18:07.0 -0500
+++ linux-2.6.18-mm/arch/um/kernel/ptrace.c 2007-02-20 16:18:50.0
-0500
@@ -3,261 +3,29 @@
* Licensed under the GPL
*/
-#include "linux/sched.h"
-#include "linux/mm.h"
-#include "linux/errno.h"
-#include "linux/smp_lock.h"
-#include "linux/security.h"
-#include "linux/ptrace.h"
-#include "linux/audit.h"
-#ifdef CONFIG_PROC_MM
-#include "linux/proc_mm.h"
-#endif
-#include "asm/ptrace.h"
-#include "asm/uaccess.h"
-#include "kern_util.h"
-#include "skas_ptrace.h"
-#include "sysdep/ptrace.h"
-#include "os.h"
-
-static inline void set_singlestepping(struct task_struct *child, int on)
+#include
+#include
+#include
+#include
+#include
+
+const struct utrace_regset_view utrace_um_native = {
+ .name = "um",
+ .e_machine = ELF_ARCH,
+ .regsets= NULL,
+ .n = 0,
+};
+EXPORT_SYMBOL_GPL(utrace_um_native);
+
+int arch_ptrace(long *req, struct task_struct *child,
+ struct utrace_attached_engine *engine,
+ unsigned long addr, unsigned long data, long *val)
{
-if (on)
-child->ptrace |= PT_DTRACE;
-else
-child->ptrace &= ~PT_DTRACE;
-child->thread.singlestep_syscall = 0;
-
-#ifdef SUBARCH_SET_SINGLESTEPPING
-SUBARCH_SET_SINGLESTEPPING(child, on);
-#endif
+ return -ENOSYS;
}
-/*
- * Called by kernel/ptrace.c when detaching..
- */
-void ptrace_disable(struct task_struct *child)
-{
-set_singlestepping(child,0);
-}
-
-extern int peek_user(struct task_struct * child, long addr, long data);
-extern int poke_user(struct task_struct * child, long addr, long data);
-
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
-{
- int i, ret;
- unsigned long __user *p = (void __user *)(unsigned long)data;
-
- 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 long tmp;
- int copied;
-
- ret = -EIO;
- copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
- if (copied != sizeof(tmp))
- break;
- ret = put_user(tmp, p);
- break;
- }
-
- /* read the word at location addr in the USER area. */
-case PTRACE_PEEKUSR:
-ret = peek_user(child, addr, data);
-break;
-
- /* when I and D space are separate, this will have to b