initialize struct memory to zero in ipc compat (CVE-2010-4073)
This commit is contained in:
parent
8394f9abcf
commit
9e245ead59
|
@ -0,0 +1,73 @@
|
|||
From: Dan Rosenberg <drosenberg@vsecurity.com>
|
||||
Date: Wed, 27 Oct 2010 22:34:17 +0000 (-0700)
|
||||
Subject: ipc: initialize structure memory to zero for compat functions
|
||||
X-Git-Tag: v2.6.37-rc1~85^2~50
|
||||
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=03145beb455cf5c20a761e8451e30b8a74ba58d9
|
||||
|
||||
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>
|
||||
---
|
||||
|
||||
diff --git a/ipc/compat.c b/ipc/compat.c
|
||||
index 9dc2c7d..845a287 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:
|
||||
diff --git a/ipc/compat_mq.c b/ipc/compat_mq.c
|
||||
index d8d1e9f..380ea4f 100644
|
||||
--- a/ipc/compat_mq.c
|
||||
+++ b/ipc/compat_mq.c
|
||||
@@ -53,6 +53,9 @@ asmlinkage long compat_sys_mq_open(const char __user *u_name,
|
||||
void __user *p = NULL;
|
||||
if (u_attr && oflag & O_CREAT) {
|
||||
struct mq_attr attr;
|
||||
+
|
||||
+ memset(&attr, 0, sizeof(attr));
|
||||
+
|
||||
p = compat_alloc_user_space(sizeof(attr));
|
||||
if (get_compat_mq_attr(&attr, u_attr) ||
|
||||
copy_to_user(p, &attr, sizeof(attr)))
|
||||
@@ -127,6 +130,8 @@ asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes,
|
||||
struct mq_attr __user *p = compat_alloc_user_space(2 * sizeof(*p));
|
||||
long ret;
|
||||
|
||||
+ memset(&mqstat, 0, sizeof(mqstat));
|
||||
+
|
||||
if (u_mqstat) {
|
||||
if (get_compat_mq_attr(&mqstat, u_mqstat) ||
|
||||
copy_to_user(p, &mqstat, sizeof(mqstat)))
|
|
@ -844,6 +844,8 @@ Patch13646: tpm-autodetect-itpm-devices.patch
|
|||
Patch13647: rt2x00-disable-auto-wakeup-before-waking-up-device.patch
|
||||
Patch13648: rt2x00-fix-failed-SLEEP-AWAKE-and-AWAKE-SLEEP-transitions.patch
|
||||
|
||||
Patch13700: ipc-zero-struct-memory-for-compat-fns.patch
|
||||
|
||||
%endif
|
||||
|
||||
BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
|
||||
|
@ -1600,6 +1602,9 @@ ApplyPatch tpm-autodetect-itpm-devices.patch
|
|||
ApplyPatch rt2x00-disable-auto-wakeup-before-waking-up-device.patch
|
||||
ApplyPatch rt2x00-fix-failed-SLEEP-AWAKE-and-AWAKE-SLEEP-transitions.patch
|
||||
|
||||
# rhbz#648658 (CVE-2010-4073)
|
||||
ApplyPatch ipc-zero-struct-memory-for-compat-fns.patch
|
||||
|
||||
# END OF PATCH APPLICATIONS
|
||||
|
||||
%endif
|
||||
|
@ -2221,6 +2226,9 @@ fi
|
|||
|
||||
|
||||
%changelog
|
||||
* Tue Nov 23 2010 Kyle McMartin <kyle@redhat.com>
|
||||
- zero struct memory in ipc compat (CVE-2010-4073) (#648658)
|
||||
|
||||
* Fri Oct 22 2010 Kyle McMartin <kyle@redhat.cmo> 2.6.34.7-62
|
||||
- tpm-autodetect-itpm-devices.patch: Auto-fix TPM issues on various
|
||||
laptops which prevented suspend/resume.
|
||||
|
|
Loading…
Reference in New Issue