From: Nicholas Nethercote Date: Tue, 9 Jun 2009 23:44:42 +0000 (+0000) Subject: Handle shmctl on Darwin. From bug 191271. X-Git-Tag: svn/VALGRIND_3_5_0~510 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2a9e26c733c271041973299b7bd7ae09f2bd3429;p=thirdparty%2Fvalgrind.git Handle shmctl on Darwin. From bug 191271. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10287 --- diff --git a/coregrind/m_syswrap/priv_syswrap-darwin.h b/coregrind/m_syswrap/priv_syswrap-darwin.h index 6dd8cb344b..4f0d5a4002 100644 --- a/coregrind/m_syswrap/priv_syswrap-darwin.h +++ b/coregrind/m_syswrap/priv_syswrap-darwin.h @@ -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); diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index d9278e555a..f1a8a5e4b6 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -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), diff --git a/memcheck/tests/darwin/scalar.c b/memcheck/tests/darwin/scalar.c index 2ee66ea190..c185b320ca 100644 --- a/memcheck/tests/darwin/scalar.c +++ b/memcheck/tests/darwin/scalar.c @@ -3,6 +3,7 @@ #include #include #include +#include // 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 diff --git a/memcheck/tests/darwin/scalar.stderr.exp b/memcheck/tests/darwin/scalar.stderr.exp index 0f3f1dbe70..4ef5bfc8ae 100644 --- a/memcheck/tests/darwin/scalar.stderr.exp +++ b/memcheck/tests/darwin/scalar.stderr.exp @@ -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 -----------------------------------------------------