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);
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);
// _____(__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),
#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.
// __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
...
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
-----------------------------------------------------
...
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
-----------------------------------------------------