1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
  
     | 
    
      diff -Naur linux-2.6.32.2/include/linux/ptrace.h linux-2.6.32.2.vm1/include/linux/ptrace.h
--- linux-2.6.32.2/include/linux/ptrace.h	2009-12-18 23:27:07.000000000 +0100
+++ linux-2.6.32.2.vm1/include/linux/ptrace.h	2010-01-03 18:43:16.000000000 +0100
@@ -46,6 +46,11 @@
 #define PTRACE_EVENT_VFORK_DONE	5
 #define PTRACE_EVENT_EXIT	6
 
+/* options for new PTRACE_SYSCALL syntax*/
+#define PTRACE_SYSCALL_SKIPEXIT  0x2
+#define PTRACE_SYSCALL_SKIPCALL  0x6
+#define PTRACE_SYSCALL_MASK    0x00000006
+
 #include <asm/ptrace.h>
 
 #ifdef __KERNEL__
@@ -68,6 +73,11 @@
 #define PT_TRACE_VFORK_DONE	0x00000100
 #define PT_TRACE_EXIT	0x00000200
 
+#define PT_SYSCALL_SKIPEXIT  0x60000000
+#define PT_SYSCALL_SKIPCALL  0x40000000
+#define PT_SYSCALL_MASK      0x60000000
+#define PTRACE2PT_SYSCALL(X)	(((X) & PTRACE_SYSCALL_MASK) << 28)
+
 #define PT_TRACE_MASK	0x000003f4
 
 /* single stepping state bits (used on ARM and PA-RISC) */
diff -Naur linux-2.6.32.2/include/linux/tracehook.h linux-2.6.32.2.vm1/include/linux/tracehook.h
--- linux-2.6.32.2/include/linux/tracehook.h	2009-12-18 23:27:07.000000000 +0100
+++ linux-2.6.32.2.vm1/include/linux/tracehook.h	2010-01-03 18:43:16.000000000 +0100
@@ -112,7 +112,7 @@
 	struct pt_regs *regs)
 {
 	ptrace_report_syscall(regs);
-	return 0;
+	return (task_ptrace(current) & PT_SYSCALL_SKIPCALL) ? 1 : 0;
 }
 
 /**
@@ -134,7 +134,8 @@
  */
 static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
 {
-	ptrace_report_syscall(regs);
+	if (!(task_ptrace(current) & PT_SYSCALL_SKIPEXIT))
+		ptrace_report_syscall(regs);
 }
 
 /**
diff -Naur linux-2.6.32.2/kernel/ptrace.c linux-2.6.32.2.vm1/kernel/ptrace.c
--- linux-2.6.32.2/kernel/ptrace.c	2009-12-18 23:27:07.000000000 +0100
+++ linux-2.6.32.2.vm1/kernel/ptrace.c	2010-01-03 18:43:16.000000000 +0100
@@ -476,7 +476,8 @@
 #define is_sysemu_singlestep(request)	0
 #endif
 
-static int ptrace_resume(struct task_struct *child, long request, long data)
+static int ptrace_resume(struct task_struct *child, long request, 
+		   long addr, long data)
 {
 	if (!valid_signal(data))
 		return -EIO;
@@ -505,6 +506,9 @@
 		user_disable_single_step(child);
 	}
 
+	child->ptrace &= ~PT_SYSCALL_MASK;
+	child->ptrace |= PTRACE2PT_SYSCALL(addr);
+
 	child->exit_code = data;
 	wake_up_process(child);
 
@@ -566,12 +570,12 @@
 #endif
 	case PTRACE_SYSCALL:
 	case PTRACE_CONT:
-		return ptrace_resume(child, request, data);
+		return ptrace_resume(child, request, addr, data);
 
 	case PTRACE_KILL:
 		if (child->exit_state)	/* already dead */
 			return 0;
-		return ptrace_resume(child, request, SIGKILL);
+		return ptrace_resume(child, request, addr, SIGKILL);
 
 	default:
 		break;
 
     |