linux-stable/ipc
Dan Rosenberg ff63490293 sys_semctl: fix kernel stack leakage
commit 982f7c2b2e upstream.

The semctl syscall has several code paths that lead to the leakage of
uninitialized kernel stack memory (namely the IPC_INFO, SEM_INFO,
IPC_STAT, and SEM_STAT commands) during the use of the older, obsolete
version of the semid_ds struct.

The copy_semid_to_user() function declares a semid_ds struct on the stack
and copies it back to the user without initializing or zeroing the
"sem_base", "sem_pending", "sem_pending_last", and "undo" pointers,
allowing the leakage of 16 bytes of kernel stack memory.

The code is still reachable on 32-bit systems - when calling semctl()
newer glibc's automatically OR the IPC command with the IPC_64 flag, but
invoking the syscall directly allows users to use the older versions of
the struct.

Signed-off-by: Dan Rosenberg <dan.j.rosenberg@gmail.com>
Cc: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-12-09 13:24:17 -08:00
..
compat_mq.c ipc: initialize structure memory to zero for compat functions 2010-12-09 13:24:16 -08:00
compat.c ipc: initialize structure memory to zero for compat functions 2010-12-09 13:24:16 -08:00
ipc_sysctl.c ipc: do not use a negative value to re-enable msgmni automatic recomputing 2008-07-25 10:53:42 -07:00
ipcns_notifier.c ipc: do not use a negative value to re-enable msgmni automatic recomputing 2008-07-25 10:53:42 -07:00
Makefile ipc: recompute msgmni on ipc namespace creation/removal 2008-04-29 08:06:12 -07:00
mqueue.c mqueue: fix si_pid value in mqueue do_notify() 2009-02-20 14:36:54 -08:00
msg.c ipc ns: fix memory leak (idr) 2010-01-28 15:20:38 -08:00
msgutil.c [PATCH] getting rid of all casts of k[cmz]alloc() calls 2006-12-13 09:05:58 -08:00
namespace.c ipc: recompute msgmni on ipc namespace creation/removal 2008-04-29 08:06:12 -07:00
sem.c sys_semctl: fix kernel stack leakage 2010-12-09 13:24:17 -08:00
shm.c ipc: shm: fix information leak to userland 2010-12-09 13:24:17 -08:00
util.c sysvipc: fix the ipc structures initialization 2008-12-05 10:55:11 -08:00
util.h ipc: get rid of ipc_lock_down() 2008-07-25 10:53:42 -07:00