Skip to contentSkip to conversation

ptrace_multi: speedup for virtual machines (and debuggers) running on ptrace

PATCH In review Renzo Davoli 1 participant 1 message Jun 16, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ptrace_multi: speedup for virtual machines (and debuggers) running on ptrace

This patch implements PTRACE_MULTI.

Several ptrace requests can be packed up and sent together to the kernel. This speeds up Virtual Machines and, if you like, debuggers.

---

include/linux/mm.h +1 -0
diff -Naur linux-2.6.26-rc6/include/linux/mm.h linux-2.6.26-rc6-ptrace_multi/include/linux/mm.h
@@ -804,6 +804,7 @@
 
 extern int make_pages_present(unsigned long addr, unsigned long end);
 extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
+extern int access_process_vm_user(struct task_struct *tsk, unsigned long addr, char __user *ubuf, int len, int write, int string);
 
 int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
 		int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
include/linux/ptrace.h +13 -0
diff -Naur linux-2.6.26-rc6/include/linux/ptrace.h linux-2.6.26-rc6-ptrace_multi/include/linux/ptrace.h
@@ -27,6 +27,18 @@
 #define PTRACE_GETSIGINFO	0x4202
 #define PTRACE_SETSIGINFO	0x4203
 
+#define PTRACE_MULTI            0x4300
+#define PTRACE_PEEKCHARDATA     0x4301
+#define PTRACE_POKECHARDATA     0x4302
+#define PTRACE_PEEKSTRINGDATA   0x4303
+
+struct ptrace_multi {
+	long request;
+	long addr;
+	void *localaddr;
+	long length;
+};
+
 /* options set using PTRACE_SETOPTIONS */
 #define PTRACE_O_TRACESYSGOOD	0x00000001
 #define PTRACE_O_TRACEFORK	0x00000002
@@ -84,6 +96,7 @@
 extern struct task_struct *ptrace_get_task_struct(pid_t pid);
 extern int ptrace_traceme(void);
 extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
+extern int ptrace_readstringdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
 extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
 extern int ptrace_attach(struct task_struct *tsk);
 extern int ptrace_detach(struct task_struct *, unsigned int);
kernel/ptrace.c +118 -46

205 lines not on this page · raw message

mm/memory.c +68 -0

74 lines not on this page · raw message

patch-linux-2.6.25.5-ptrace_vm +1 -0
diff -Naur linux-2.6.26-rc6/patch-linux-2.6.25.5-ptrace_vm linux-2.6.26-rc6-ptrace_multi/patch-linux-2.6.25.5-ptrace_vm
@@ -0,0 +1 @@
+diff -Naur linux-2.6.25.5 linux-2.6.25.5.ptrace_vm