ipc: shm: fix information leak to userland
authorVasiliy Kulikov <segooon@gmail.com>
Sat, 30 Oct 2010 14:22:49 +0000 (18:22 +0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 30 Oct 2010 15:25:51 +0000 (08:25 -0700)
The shmid_ds structure is copied to userland with shm_unused{,2,3}
fields unitialized.  It leads to leaking of contents of kernel stack
memory.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Acked-by: Al Viro <viro@ZenIV.linux.org.uk>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ipc/shm.c

index fd658a1c2b88d43f565baaeb3666cc583caaef28..7d3bb22a93022e4911028bffd6710f1426e7b0e8 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -479,6 +479,7 @@ static inline unsigned long copy_shmid_to_user(void __user *buf, struct shmid64_
            {
                struct shmid_ds out;
 
+               memset(&out, 0, sizeof(out));
                ipc64_perm_to_ipc_perm(&in->shm_perm, &out.shm_perm);
                out.shm_segsz   = in->shm_segsz;
                out.shm_atime   = in->shm_atime;