]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Handle some additional ptrace reason codes. Based on a patch
authorTom Hughes <tom@compton.nu>
Wed, 7 Mar 2007 09:48:32 +0000 (09:48 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 7 Mar 2007 09:48:32 +0000 (09:48 +0000)
from Magnus Vesterlund <magnus_vesterlund@hotmail.com>.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6630

coregrind/m_syswrap/syswrap-amd64-linux.c
coregrind/m_syswrap/syswrap-x86-linux.c
include/vki/vki-linux.h

index 781d63e018eea1bc5b51407781a9e55e6407c660..7d4daa337e0f30e15ae476cc832ed5ad705eb8b1 100644 (file)
@@ -517,7 +517,11 @@ PRE(sys_arch_prctl)
 }
 
 // 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(sys_ptrace)
       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 @@ POST(sys_ptrace)
    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;
    }
index 081f9a001ada5979f1933ac3d3fca805492fe76c..a607251587cef11be913ef99f6582002fe0fca36 100644 (file)
@@ -1042,7 +1042,11 @@ PRE(sys_get_thread_area)
 }
 
 // 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(sys_ptrace)
       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 @@ POST(sys_ptrace)
    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;
    }
index 209d88c4c9bf20940f7484e20ee71fb6e8b492e1..a2903cdc426a15505f09da220b5937f8fdaef788 100644 (file)
@@ -2091,7 +2091,7 @@ struct vki_console_font_op {
 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,7 +2100,11 @@ typedef __vki_kernel_uid32_t vki_qid_t; /* Type in which we store ids in memory
 #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