summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sanitizer_common')
-rw-r--r--lib/sanitizer_common/sanitizer_common_interceptors.inc2
-rw-r--r--lib/sanitizer_common/sanitizer_common_syscalls.inc2
-rw-r--r--lib/sanitizer_common/sanitizer_platform_limits_posix.cc22
-rw-r--r--lib/sanitizer_common/sanitizer_platform_limits_posix.h39
4 files changed, 60 insertions, 5 deletions
diff --git a/lib/sanitizer_common/sanitizer_common_interceptors.inc b/lib/sanitizer_common/sanitizer_common_interceptors.inc
index e13df5c2..f5179e24 100644
--- a/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -2512,7 +2512,7 @@ INTERCEPTOR(int, shmctl, int shmid, int cmd, void *buf) {
if (res >= 0) {
unsigned sz = 0;
if (cmd == shmctl_ipc_stat || cmd == shmctl_shm_stat)
- sz = struct_shmid_ds_sz;
+ sz = sizeof(__sanitizer_shmid_ds);
else if (cmd == shmctl_ipc_info)
sz = struct_shminfo_sz;
else if (cmd == shmctl_shm_info)
diff --git a/lib/sanitizer_common/sanitizer_common_syscalls.inc b/lib/sanitizer_common/sanitizer_common_syscalls.inc
index 942ffc4c..0f500d63 100644
--- a/lib/sanitizer_common/sanitizer_common_syscalls.inc
+++ b/lib/sanitizer_common/sanitizer_common_syscalls.inc
@@ -2067,7 +2067,7 @@ PRE_SYSCALL(shmctl)(long shmid, long cmd, void *buf) {}
POST_SYSCALL(shmctl)(long res, long shmid, long cmd, void *buf) {
if (res >= 0) {
- if (buf) POST_WRITE(buf, struct_shmid_ds_sz);
+ if (buf) POST_WRITE(buf, sizeof(__sanitizer_shmid_ds));
}
}
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
index 7aca7f7e..fb932bc1 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -168,7 +168,6 @@ namespace __sanitizer {
unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
unsigned struct_timex_sz = sizeof(struct timex);
unsigned struct_msqid_ds_sz = sizeof(struct msqid_ds);
- unsigned struct_shmid_ds_sz = sizeof(struct shmid_ds);
unsigned struct_mq_attr_sz = sizeof(struct mq_attr);
unsigned struct_statvfs_sz = sizeof(struct statvfs);
unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
@@ -927,4 +926,25 @@ CHECK_SIZE_AND_OFFSET(mntent, mnt_passno);
CHECK_TYPE_SIZE(ether_addr);
+#if SANITIZER_LINUX && !SANITIZER_ANDROID
+CHECK_TYPE_SIZE(ipc_perm);
+CHECK_SIZE_AND_OFFSET(ipc_perm, __key);
+CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
+CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
+CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
+CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+CHECK_SIZE_AND_OFFSET(ipc_perm, __seq);
+
+CHECK_TYPE_SIZE(shmid_ds);
+CHECK_SIZE_AND_OFFSET(shmid_ds, shm_perm);
+CHECK_SIZE_AND_OFFSET(shmid_ds, shm_segsz);
+CHECK_SIZE_AND_OFFSET(shmid_ds, shm_atime);
+CHECK_SIZE_AND_OFFSET(shmid_ds, shm_dtime);
+CHECK_SIZE_AND_OFFSET(shmid_ds, shm_ctime);
+CHECK_SIZE_AND_OFFSET(shmid_ds, shm_cpid);
+CHECK_SIZE_AND_OFFSET(shmid_ds, shm_lpid);
+CHECK_SIZE_AND_OFFSET(shmid_ds, shm_nattch);
+#endif
+
#endif // SANITIZER_LINUX || SANITIZER_MAC
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
index ae99403d..0b38d158 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -56,7 +56,6 @@ namespace __sanitizer {
extern unsigned struct_old_utsname_sz;
extern unsigned struct_oldold_utsname_sz;
extern unsigned struct_msqid_ds_sz;
- extern unsigned struct_shmid_ds_sz;
extern unsigned struct_mq_attr_sz;
extern unsigned struct_perf_event_attr_sz;
extern unsigned struct_timex_sz;
@@ -86,7 +85,43 @@ namespace __sanitizer {
extern unsigned struct_rlimit64_sz;
extern unsigned struct_statvfs_sz;
extern unsigned struct_statvfs64_sz;
-#endif // SANITIZER_LINUX && !SANITIZER_ANDROID
+
+ struct __sanitizer_ipc_perm {
+ int __key;
+ int uid;
+ int gid;
+ int cuid;
+ int cgid;
+ unsigned short mode;
+ unsigned short __pad1;
+ unsigned short __seq;
+ unsigned short __pad2;
+ uptr __unused1;
+ uptr __unused2;
+ };
+
+ struct __sanitizer_shmid_ds {
+ __sanitizer_ipc_perm shm_perm;
+ uptr shm_segsz;
+ uptr shm_atime;
+ #ifndef _LP64
+ uptr __unused1;
+ #endif
+ uptr shm_dtime;
+ #ifndef _LP64
+ uptr __unused2;
+ #endif
+ uptr shm_ctime;
+ #ifndef _LP64
+ uptr __unused3;
+ #endif
+ int shm_cpid;
+ int shm_lpid;
+ uptr shm_nattch;
+ uptr __unused4;
+ uptr __unused5;
+ };
+ #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
struct __sanitizer_iovec {
void *iov_base;