]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Handle shmctl on Darwin. From bug 191271.
authorNicholas Nethercote <njn@valgrind.org>
Tue, 9 Jun 2009 23:44:42 +0000 (23:44 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Tue, 9 Jun 2009 23:44:42 +0000 (23:44 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10287

coregrind/m_syswrap/priv_syswrap-darwin.h
coregrind/m_syswrap/syswrap-darwin.c
memcheck/tests/darwin/scalar.c
memcheck/tests/darwin/scalar.stderr.exp

index 6dd8cb344bbb3d3977c4604b124af8a055b891e2..4f0d5a4002d924fa6875f253f076f637e3438bcb 100644 (file)
@@ -81,6 +81,7 @@ DECL_TEMPLATE(darwin, sys_seteuid);
 DECL_TEMPLATE(darwin, sys_setegid);
 DECL_TEMPLATE(darwin, sys_listxattr);
 DECL_TEMPLATE(darwin, sys_flistxattr);
+DECL_TEMPLATE(darwin, sys_shmctl);
 DECL_TEMPLATE(darwin, sys_shmget);
 DECL_TEMPLATE(darwin, sys_shm_open);
 DECL_TEMPLATE(darwin, sys_statx);
index d9278e555a3bc89b151c06a76582b2bfafbf4c38..f1a8a5e4b690c9b19d346af61385ca72dd4733c7 100644 (file)
@@ -1858,6 +1858,19 @@ PRE(sys_shmget)
    PRE_REG_READ3(long, "shmget", vki_key_t, key, vki_size_t, size, int, shmflg);
 }
 
+PRE(sys_shmctl)
+{
+   PRINT("sys_shmctl ( %ld, %ld, %#lx )",ARG1,ARG2,ARG3);
+   PRE_REG_READ3(long, "shmctl",
+                 int, shmid, int, cmd, struct vki_shmid_ds *, buf);
+   ML_(generic_PRE_sys_shmctl)(tid, ARG1,ARG2,ARG3);
+}
+
+POST(sys_shmctl)
+{
+   ML_(generic_POST_sys_shmctl)(tid, RES,ARG1,ARG2,ARG3);
+}
+
 PRE(sys_shm_open)
 {
    PRINT("shm_open(%#lx(%s), %ld, %ld)", ARG1, (char *)ARG1, ARG2, ARG3);
@@ -7226,7 +7239,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
 // _____(__NR_msgsnd),   // 260
 // _____(__NR_msgrcv), 
 // _____(__NR_shmat), 
-// _____(__NR_shmctl), 
+   MACXY(__NR_shmctl, sys_shmctl), 
 // _____(__NR_shmdt), 
    MACX_(__NR_shmget, sys_shmget), 
    MACXY(__NR_shm_open, sys_shm_open), 
index 2ee66ea190de7baad3c8c3eeb2000603908aecf9..c185b320cadd5e134d278b22476856ff5e61db21 100644 (file)
@@ -3,6 +3,7 @@
 #include <unistd.h>
 #include <sched.h>
 #include <signal.h>
+#include <sys/shm.h>
 
 // See memcheck/tests/x86-linux/scalar.c for an explanation of what this test
 // is doing.
@@ -309,7 +310,11 @@ int main(void)
    // __NR_msgsnd 260
    // __NR_msgrcv 261
    // __NR_shmat 262
+
    // __NR_shmctl 263
+   GO(__NR_shmctl, "3s 1m");
+   SY(__NR_shmctl, x0, x0+IPC_STAT, x0+1); FAIL;
+
    // __NR_shmdt 264
 
    // __NR_shmget 265
index 0f3f1dbe70953025f3b2b52c5e45d33cbd4293bd..4ef5bfc8aed92bd1621824d363e0ca883bad3555 100644 (file)
@@ -83,7 +83,7 @@ Syscall param socketcall.getsockopt(optlen) points to unaddressable byte(s)
    ...
  Address 0x........ is 0 bytes after a block of size 4 alloc'd
    at 0x........: malloc (vg_replace_malloc.c:...)
-   by 0x........: main (scalar.c:13)
+   by 0x........: main (scalar.c:14)
 -----------------------------------------------------
 x20000a9(169):          __NR_csops 4s 1m
 -----------------------------------------------------
@@ -104,6 +104,22 @@ Syscall param csops(addr) points to unaddressable byte(s)
    ...
  Address 0x........ is not stack'd, malloc'd or (recently) free'd
 -----------------------------------------------------
+x2000107(263):         __NR_shmctl 3s 1m
+-----------------------------------------------------
+
+Syscall param shmctl(shmid) contains uninitialised byte(s)
+   ...
+
+Syscall param shmctl(cmd) contains uninitialised byte(s)
+   ...
+
+Syscall param shmctl(buf) contains uninitialised byte(s)
+   ...
+
+Syscall param shmctl(IPC_STAT, buf) points to unaddressable byte(s)
+   ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
 x2000109(265):         __NR_shmget 3s 0m
 -----------------------------------------------------