git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4751
This commit is contained in:
Nicholas Nethercote 2005-09-24 19:42:41 +00:00
parent ccbfb353ff
commit a00ea1b94b
6 changed files with 41 additions and 4 deletions

View File

@ -1601,12 +1601,23 @@ PRE(sys_munlockall)
PRE_REG_READ0(long, "munlockall");
}
// XXX: sort of x86/Linux-specific
// This has different signatures for different platforms.
//
// x86: int sys_pipe(unsigned long __user *fildes);
// AMD64: long sys_pipe(int *fildes);
// ppc32: int sys_pipe(int __user *fildes);
// ppc64: int sys_pipe(int __user *fildes);
//
// The type of the argument is most important, and it is an array of 32 bit
// values in all cases. (The return type differs across platforms, but it
// is not used.) So we use 'int' as its type. This fixed bug #113230 which
// was caused by using an array of 'unsigned long's, which didn't work on
// AMD64.
PRE(sys_pipe)
{
PRINT("sys_pipe ( %p )", ARG1);
PRE_REG_READ1(int, "pipe", unsigned long *, filedes);
PRE_MEM_WRITE( "pipe(filedes)", ARG1, 2*sizeof(long) );
PRE_REG_READ1(int, "pipe", int *, filedes);
PRE_MEM_WRITE( "pipe(filedes)", ARG1, 2*sizeof(int) );
}
POST(sys_pipe)
{

View File

@ -155,6 +155,13 @@ FIXED-30BRANCH: TODO
FIXED-TRUNK: TODO
FIXED-30BRANCH: TODO
----------------------------------------------------------------
113230 Valgrind sys_pipe on x86-64 wrongly thinks file descriptors
should be 64bit
FIXED-TRUNK: vg:4669
FIXED-30BRANCH: TODO
========================================================================
=== Bugs targeted for 3.1.0 and 3.0.1 (all done, 3.0.1 released) ===

View File

@ -63,6 +63,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
oset_test.stderr.exp oset_test.stdout.exp oset_test.vgtest \
partiallydefinedeq.vgtest partiallydefinedeq.stderr.exp \
partiallydefinedeq.stdout.exp \
pipe.stderr.exp pipe.vgtest \
pointer-trace.vgtest \
pointer-trace.stderr.exp pointer-trace.stderr.exp64 \
post-syscall.stderr.exp post-syscall.stdout.exp post-syscall.vgtest \
@ -107,7 +108,7 @@ check_PROGRAMS = \
nanoleak new_nothrow \
null_socket oset_test overlap \
partiallydefinedeq \
pointer-trace \
pipe pointer-trace \
post-syscall \
realloc1 realloc2 realloc3 \
sigaltstack signal2 sigprocmask sigkill \

16
memcheck/tests/pipe.c Normal file
View File

@ -0,0 +1,16 @@
// This is a regtest for bug #113230, in which 64-bit platforms mistakenly
// behaved as if pipe() took an array of 64-bit ints, when it really takes
// an array of 32-bit ints.
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int *filedes = malloc(2 * sizeof(int));
pipe(filedes);
return 0;
}

View File

View File

@ -0,0 +1,2 @@
prog: pipe
vgopts: -q