summaryrefslogtreecommitdiff
path: root/ipc/compat.c
diff options
context:
space:
mode:
authorDan Rosenberg <drosenberg@vsecurity.com>2010-10-27 15:34:17 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-27 18:03:13 -0700
commit03145beb455cf5c20a761e8451e30b8a74ba58d9 (patch)
treea27b2221818b89039fc948d19780d52bb5c70789 /ipc/compat.c
parentb795218075a1e1183169abb66a90dcdcf30367f9 (diff)
downloadrenesas_kernel-03145beb455cf5c20a761e8451e30b8a74ba58d9.tar.gz
renesas_kernel-03145beb455cf5c20a761e8451e30b8a74ba58d9.tar.bz2
renesas_kernel-03145beb455cf5c20a761e8451e30b8a74ba58d9.zip
ipc: initialize structure memory to zero for compat functions
This takes care of leaking uninitialized kernel stack memory to userspace from non-zeroed fields in structs in compat ipc functions. Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com> Cc: Manfred Spraul <manfred@colorfullife.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/compat.c')
-rw-r--r--ipc/compat.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ipc/compat.c b/ipc/compat.c
index 9dc2c7d3c9e..845a28738d3 100644
--- a/ipc/compat.c
+++ b/ipc/compat.c
@@ -241,6 +241,8 @@ long compat_sys_semctl(int first, int second, int third, void __user *uptr)
struct semid64_ds __user *up64;
int version = compat_ipc_parse_version(&third);
+ memset(&s64, 0, sizeof(s64));
+
if (!uptr)
return -EINVAL;
if (get_user(pad, (u32 __user *) uptr))
@@ -421,6 +423,8 @@ long compat_sys_msgctl(int first, int second, void __user *uptr)
int version = compat_ipc_parse_version(&second);
void __user *p;
+ memset(&m64, 0, sizeof(m64));
+
switch (second & (~IPC_64)) {
case IPC_INFO:
case IPC_RMID:
@@ -594,6 +598,8 @@ long compat_sys_shmctl(int first, int second, void __user *uptr)
int err, err2;
int version = compat_ipc_parse_version(&second);
+ memset(&s64, 0, sizeof(s64));
+
switch (second & (~IPC_64)) {
case IPC_RMID:
case SHM_LOCK: