Introduce a test to reproduce bug 123837 (semctl GETVAL false positive)

The test succeeds on amd64, but fails on x86, with the following diff:

+Syscall param semctl(arg) points to uninitialised byte(s)
+   at 0x........: semctl@@GLIBC_2.2 (semctl.c:109)
+   by 0x........: main (sem.c:36)
+ Address 0x........ is on thread 1's stack
+
+Syscall param semctl(arg) points to uninitialised byte(s)
+   at 0x........: semctl@@GLIBC_2.2 (semctl.c:109)
+   by 0x........: main (sem.c:43)
+ Address 0x........ is on thread 1's stack
+



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13073
This commit is contained in:
Philippe Waroquiers 2012-10-21 18:46:09 +00:00
parent 0df0a2725c
commit 979dc8596b
4 changed files with 27 additions and 0 deletions

View File

@ -180,6 +180,7 @@ EXTRA_DIST = \
realloc2.stderr.exp realloc2.vgtest \
realloc3.stderr.exp realloc3.vgtest \
sbfragment.stdout.exp sbfragment.stderr.exp sbfragment.vgtest \
sem.stderr.exp sem.vgtest \
sh-mem.stderr.exp sh-mem.vgtest \
sh-mem-random.stderr.exp sh-mem-random.stdout.exp64 \
sh-mem-random.stdout.exp sh-mem-random.vgtest \

View File

@ -0,0 +1,10 @@
HEAP SUMMARY:
in use at exit: 0 bytes in 0 blocks
total heap usage: 0 allocs, 0 frees, 0 bytes allocated
For a detailed leak analysis, rerun with: --leak-check=full
For counts of detected and suppressed errors, rerun with: -v
ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

View File

@ -0,0 +1 @@
prog: ../../none/tests/sem

View File

@ -7,6 +7,7 @@
#include <sys/ipc.h>
#include <sys/sem.h>
#include <time.h>
#include <unistd.h>
int main(int argc, char **argv)
{
int semid;
@ -32,6 +33,20 @@ int main(int argc, char **argv)
exit(1);
}
if (semctl(semid, 0, GETVAL) != 1)
{
perror("semctl GETVAL");
semctl(semid, 0, IPC_RMID);
exit(1);
}
if (semctl(semid, 0, GETPID) != getpid())
{
perror("semctl GETPID");
semctl(semid, 0, IPC_RMID);
exit(1);
}
/* The next call to semtimedop causes the program to hang on
ppc32-linux (Yellow Dog 4.0). I don't know why. Hence the
extended ifdef. */