From: Kees Cook <keescook@chromium.org>
To: linux-kernel@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, Mathias Krause <minipli@googlemail.com>,
Brad Spengler <spender@grsecurity.net>
Subject: [PATCH] net: pre-clear the returned sockaddr_storage variable
Date: Tue, 9 Apr 2013 10:50:24 -0700 [thread overview]
Message-ID: <20130409175024.GA19308@www.outflux.net> (raw)
To avoid future stack content leaks in the various protocols, pre-clear
the returned memory.
Signed-off-by: Kees Cook <keescook@chromium.org>
Suggested-by: Brad Spengler <spender@grsecurity.net>
---
net/socket.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/socket.c b/net/socket.c
index 88f759a..4d2af0d 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1838,7 +1838,7 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size,
struct socket *sock;
struct iovec iov;
struct msghdr msg;
- struct sockaddr_storage address;
+ struct sockaddr_storage address = { };
int err, err2;
int fput_needed;
@@ -2185,7 +2185,7 @@ static int __sys_recvmsg(struct socket *sock, struct msghdr __user *msg,
int err, total_len, len;
/* kernel mode address */
- struct sockaddr_storage addr;
+ struct sockaddr_storage addr = { };
/* user mode address pointers */
struct sockaddr __user *uaddr;
--
1.7.9.5
--
Kees Cook
Chrome OS Security
next reply other threads:[~2013-04-09 17:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-09 17:50 Kees Cook [this message]
2013-04-09 18:10 ` [PATCH] net: pre-clear the returned sockaddr_storage variable Eric Dumazet
2013-04-09 19:05 ` David Miller
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=20130409175024.GA19308@www.outflux.net \
--to=keescook@chromium.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=minipli@googlemail.com \
--cc=netdev@vger.kernel.org \
--cc=spender@grsecurity.net \
/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;
as well as URLs for NNTP newsgroup(s).