From: Kees Cook <kees.cook@canonical.com>
To: linux-kernel@vger.kernel.org
Cc: Pekka Enberg <penberg@kernel.org>, Joe Perches <joe@perches.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
Jiri Slaby <jslaby@suse.cz>,
"David S. Miller" <davem@davemloft.net>,
Hugh Dickins <hughd@google.com>,
Manfred Spraul <manfred@colorfullife.com>,
Vasiliy Kulikov <segooon@gmail.com>
Subject: [PATCH] ipc: explicitly clear stack memory for shminfo
Date: Tue, 16 Nov 2010 11:58:28 -0800 [thread overview]
Message-ID: <1289937508-19458-1-git-send-email-kees.cook@canonical.com> (raw)
This fixes a kernel stack memory contents leak by explicitly clearing
the shminfo structure on the kernel stack before it is populated and
copied back to userspace.
Signed-off-by: Kees Cook <kees.cook@canonical.com>
Acked-by: Pekka Enberg <penberg@kernel.org>
---
ipc/shm.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/ipc/shm.c b/ipc/shm.c
index 7d3bb22..1d3d41f 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -531,6 +531,7 @@ static inline unsigned long copy_shminfo_to_user(void __user *buf, struct shminf
{
struct shminfo out;
+ memset(&out, 0, sizeof(out));
if(in->shmmax > INT_MAX)
out.shmmax = INT_MAX;
else
--
1.7.2.3
next reply other threads:[~2010-11-16 19:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-16 19:58 Kees Cook [this message]
2010-11-16 20:08 ` Joe Perches
2010-11-16 20:16 ` Vasiliy Kulikov
2010-11-16 20:51 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1289937508-19458-1-git-send-email-kees.cook@canonical.com \
--to=kees.cook@canonical.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=hughd@google.com \
--cc=joe@perches.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
--cc=penberg@kernel.org \
--cc=segooon@gmail.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®