Handle some additional ptrace reason codes. Based on a patch

from Magnus Vesterlund <magnus_vesterlund@hotmail.com>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6630
This commit is contained in:
Tom Hughes 2007-03-07 09:48:32 +00:00
parent 317ceb5fe3
commit cbb98bc70d
3 changed files with 52 additions and 4 deletions

View 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;
}

View 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;
}

View 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