|
From: <sv...@va...> - 2007-03-07 09:48:35
|
Author: tom
Date: 2007-03-07 09:48:32 +0000 (Wed, 07 Mar 2007)
New Revision: 6630
Log:
Handle some additional ptrace reason codes. Based on a patch
from Magnus Vesterlund <mag...@ho...>.
Modified:
trunk/coregrind/m_syswrap/syswrap-amd64-linux.c
trunk/coregrind/m_syswrap/syswrap-x86-linux.c
trunk/include/vki/vki-linux.h
Modified: trunk/coregrind/m_syswrap/syswrap-amd64-linux.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-amd64-linux.c 2007-02-28 14:10:43 UTC (rev 6629)
+++ trunk/coregrind/m_syswrap/syswrap-amd64-linux.c 2007-03-07 09:48:32 UTC (rev 6630)
@@ -517,7 +517,11 @@
}
// Parts of this are amd64-specific, but the *PEEK* cases are generic.
-// XXX: Why is the memory pointed to by ARG3 never checked?
+//
+// ARG3 is only used for pointers into the traced process's address
+// space and for offsets into the traced process's struct
+// user_regs_struct. It is never a pointer into this process's memory
+// space, and we should therefore not check anything it points to.
PRE(sys_ptrace)
{
PRINT("sys_ptrace ( %d, %d, %p, %p )", ARG1,ARG2,ARG3,ARG4);
@@ -546,6 +550,15 @@
PRE_MEM_READ( "ptrace(setfpregs)", ARG4,
sizeof (struct vki_user_i387_struct));
break;
+ case VKI_PTRACE_GETEVENTMSG:
+ PRE_MEM_WRITE( "ptrace(geteventmsg)", ARG4, sizeof(unsigned long));
+ break;
+ case VKI_PTRACE_GETSIGINFO:
+ PRE_MEM_WRITE( "ptrace(getsiginfo)", ARG4, sizeof(vki_siginfo_t));
+ break;
+ case VKI_PTRACE_SETSIGINFO:
+ PRE_MEM_READ( "ptrace(setsiginfo)", ARG4, sizeof(vki_siginfo_t));
+ break;
default:
break;
}
@@ -565,6 +578,15 @@
case VKI_PTRACE_GETFPREGS:
POST_MEM_WRITE( ARG4, sizeof (struct vki_user_i387_struct));
break;
+ case VKI_PTRACE_GETEVENTMSG:
+ POST_MEM_WRITE( ARG4, sizeof(unsigned long));
+ break;
+ case VKI_PTRACE_GETSIGINFO:
+ /* XXX: This is a simplification. Different parts of the
+ * siginfo_t are valid depending on the type of signal.
+ */
+ POST_MEM_WRITE( ARG4, sizeof(vki_siginfo_t));
+ break;
default:
break;
}
Modified: trunk/coregrind/m_syswrap/syswrap-x86-linux.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-x86-linux.c 2007-02-28 14:10:43 UTC (rev 6629)
+++ trunk/coregrind/m_syswrap/syswrap-x86-linux.c 2007-03-07 09:48:32 UTC (rev 6630)
@@ -1042,7 +1042,11 @@
}
// Parts of this are x86-specific, but the *PEEK* cases are generic.
-// XXX: Why is the memory pointed to by ARG3 never checked?
+//
+// ARG3 is only used for pointers into the traced process's address
+// space and for offsets into the traced process's struct
+// user_regs_struct. It is never a pointer into this process's memory
+// space, and we should therefore not check anything it points to.
PRE(sys_ptrace)
{
PRINT("sys_ptrace ( %d, %d, %p, %p )", ARG1,ARG2,ARG3,ARG4);
@@ -1079,6 +1083,15 @@
PRE_MEM_READ( "ptrace(setfpxregs)", ARG4,
sizeof(struct vki_user_fxsr_struct) );
break;
+ case VKI_PTRACE_GETEVENTMSG:
+ PRE_MEM_WRITE( "ptrace(geteventmsg)", ARG4, sizeof(unsigned long));
+ break;
+ case VKI_PTRACE_GETSIGINFO:
+ PRE_MEM_WRITE( "ptrace(getsiginfo)", ARG4, sizeof(vki_siginfo_t));
+ break;
+ case VKI_PTRACE_SETSIGINFO:
+ PRE_MEM_READ( "ptrace(setsiginfo)", ARG4, sizeof(vki_siginfo_t));
+ break;
default:
break;
}
@@ -1101,6 +1114,15 @@
case VKI_PTRACE_GETFPXREGS:
POST_MEM_WRITE( ARG4, sizeof(struct vki_user_fxsr_struct) );
break;
+ case VKI_PTRACE_GETEVENTMSG:
+ POST_MEM_WRITE( ARG4, sizeof(unsigned long));
+ break;
+ case VKI_PTRACE_GETSIGINFO:
+ /* XXX: This is a simplification. Different parts of the
+ * siginfo_t are valid depending on the type of signal.
+ */
+ POST_MEM_WRITE( ARG4, sizeof(vki_siginfo_t));
+ break;
default:
break;
}
Modified: trunk/include/vki/vki-linux.h
===================================================================
--- trunk/include/vki/vki-linux.h 2007-02-28 14:10:43 UTC (rev 6629)
+++ trunk/include/vki/vki-linux.h 2007-03-07 09:48:32 UTC (rev 6630)
@@ -2091,7 +2091,7 @@
typedef __vki_kernel_uid32_t vki_qid_t; /* Type in which we store ids in memory */
//----------------------------------------------------------------------
-// From linux-2.6.9/include/linux/ptrace.h
+// From linux-2.6.20.1/include/linux/ptrace.h
//----------------------------------------------------------------------
#define VKI_PTRACE_TRACEME 0
@@ -2100,8 +2100,12 @@
#define VKI_PTRACE_PEEKUSR 3
#define VKI_PTRACE_POKEUSR 6
-#define VKI_PTRACE_DETACH 0x11
+#define VKI_PTRACE_DETACH 17
+#define VKI_PTRACE_GETEVENTMSG 0x4201
+#define VKI_PTRACE_GETSIGINFO 0x4202
+#define VKI_PTRACE_SETSIGINFO 0x4203
+
//----------------------------------------------------------------------
// From linux-2.6.14/include/sound/asound.h
//----------------------------------------------------------------------
|