diff -uprN linux-source-3.8.0.orig/arch/x86/include/asm/thread_info.h linux-source-3.8.0/arch/x86/include/asm/thread_info.h
--- linux-source-3.8.0.orig/arch/x86/include/asm/thread_info.h	2013-02-18 15:58:34.000000000 -0800
+++ linux-source-3.8.0/arch/x86/include/asm/thread_info.h	2013-08-30 08:35:49.785610611 -0700
@@ -119,20 +119,19 @@ struct thread_info {
 #define _TIF_FORCED_TF		(1 << TIF_FORCED_TF)
 #define _TIF_BLOCKSTEP		(1 << TIF_BLOCKSTEP)
 #define _TIF_LAZY_MMU_UPDATES	(1 << TIF_LAZY_MMU_UPDATES)
-#define _TIF_SYSCALL_TRACEPOINT	(1 << TIF_SYSCALL_TRACEPOINT)
 #define _TIF_ADDR32		(1 << TIF_ADDR32)
 #define _TIF_X32		(1 << TIF_X32)
 
 /* work to do in syscall_trace_enter() */
 #define _TIF_WORK_SYSCALL_ENTRY	\
 	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | _TIF_SYSCALL_AUDIT |	\
-	 _TIF_SECCOMP | _TIF_SINGLESTEP | _TIF_SYSCALL_TRACEPOINT |	\
+	 _TIF_SECCOMP | _TIF_SINGLESTEP |	\
 	 _TIF_NOHZ)
 
 /* work to do in syscall_trace_leave() */
 #define _TIF_WORK_SYSCALL_EXIT	\
 	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP |	\
-	 _TIF_SYSCALL_TRACEPOINT | _TIF_NOHZ)
+	 _TIF_NOHZ)
 
 /* work to do on interrupt/exception return */
 #define _TIF_WORK_MASK							\
@@ -142,7 +141,7 @@ struct thread_info {
 
 /* work to do on any return to user space */
 #define _TIF_ALLWORK_MASK						\
-	((0x0000FFFF & ~_TIF_SECCOMP) | _TIF_SYSCALL_TRACEPOINT |	\
+	((0x0000FFFF & ~_TIF_SECCOMP) | 	\
 	_TIF_NOHZ)
 
 /* Only used for 64 bit */
diff -uprN linux-source-3.8.0.orig/arch/x86/kernel/entry_64.S linux-source-3.8.0/arch/x86/kernel/entry_64.S
--- linux-source-3.8.0.orig/arch/x86/kernel/entry_64.S	2013-02-18 15:58:34.000000000 -0800
+++ linux-source-3.8.0/arch/x86/kernel/entry_64.S	2013-08-30 10:52:27.732403617 -0700
@@ -633,6 +633,12 @@ GLOBAL(system_call_after_swapgs)
 	testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
 	jnz tracesys
 system_call_fastpath:
+	SAVE_REST
+	FIXUP_TOP_OF_STACK %rdi
+	movq %rsp,%rdi
+	call syscall_tracepoint_enter 
+	LOAD_ARGS ARGOFFSET, 0
+	RESTORE_REST
 #if __SYSCALL_MASK == ~0
 	cmpq $__NR_syscall_max,%rax
 #else
@@ -648,6 +654,12 @@ system_call_fastpath:
  * Has incomplete stack frame and undefined top of stack.
  */
 ret_from_sys_call:
+	SAVE_REST
+	pushq_cfi %rdi
+	leaq 8(%rsp),%rdi	# &ptregs -> arg1
+	call syscall_trace_leave
+	popq_cfi %rdi
+	RESTORE_REST
 	movl $_TIF_ALLWORK_MASK,%edi
 	/* edi:	flagmask */
 sysret_check:
diff -uprN linux-source-3.8.0.orig/arch/x86/kernel/ptrace.c linux-source-3.8.0/arch/x86/kernel/ptrace.c
--- linux-source-3.8.0.orig/arch/x86/kernel/ptrace.c	2013-02-18 15:58:34.000000000 -0800
+++ linux-source-3.8.0/arch/x86/kernel/ptrace.c	2013-08-30 10:30:08.217072845 -0700
@@ -1567,3 +1567,16 @@ void syscall_trace_leave(struct pt_regs
 
 	user_enter();
 }
+
+void syscall_tracepoint_enter(struct pt_regs *regs)
+{
+	if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
+		trace_sys_enter(regs, regs->orig_ax);
+}
+
+void syscall_tracepoint_leave(struct pt_regs *regs)
+{
+	if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
+		trace_sys_exit(regs, regs->ax);
+}
+
