Skip to contentSkip to conversation

crypto: algif - suppress sending source address information in recvmsg

PATCH In review Mathias Krause 2 participants 5 messages Apr 7, 2013 – Apr 21, 2013 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: algif - suppress sending source address information in recvmsg

The current code does not set the msg_namelen member to 0 and therefore makes net/socket.c leak the local sockaddr_storage variable to userland -- 128 bytes of kernel stack memory. Fix that.

---
 crypto/algif_hash.c     |    2 ++
 crypto/algif_skcipher.c |    1 +
 2 files changed, 3 insertions(+)
crypto/algif_hash.c +2 -0
index ef5356c..0262210 100644
@@ -161,6 +161,8 @@ static int hash_recvmsg(struct kiocb *unused, struct socket *sock,
 	else if (len < ds)
 		msg->msg_flags |= MSG_TRUNC;
 
+	msg->msg_namelen = 0;
+
 	lock_sock(sk);
 	if (ctx->more) {
 		ctx->more = 0;
crypto/algif_skcipher.c +1 -0
index 6a6dfc0..a1c4f0a 100644
@@ -432,6 +432,7 @@ static int skcipher_recvmsg(struct kiocb *unused, struct socket *sock,
 	long copied = 0;
 
 	lock_sock(sk);
+	msg->msg_namelen = 0;
 	for (iov = msg->msg_iov, iovlen = msg->msg_iovlen; iovlen > 0;
 	     iovlen--, iov++) {
 		unsigned long seglen = iov->iov_len;
Signature · 1 line
1.7.10.4
maintainer
#1 lore raw
Quoted 5 lines · Mathias Krause

The current code does not set the msg_namelen member to 0 and therefore makes net/socket.c leak the local sockaddr_storage variable to userland -- 128 bytes of kernel stack memory. Fix that.

Patch applied. Thanks!

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#2 lore raw
Quoted 8 lines · Herbert Xu
Quoted 5 lines · Mathias Krause

The current code does not set the msg_namelen member to 0 and therefore makes net/socket.c leak the local sockaddr_storage variable to userland -- 128 bytes of kernel stack memory. Fix that.

Patch applied. Thanks!

Thanks, but that patch shouldn't have been applied to cryptodev but crypto instead, and probably queued up for stable as well. I missed the 'Cc: stable # v2.6.38'. My bad.

Mathias

maintainer
#3 lore raw
Quoted 6 lines · Mathias Krause
Quoted 5 lines · Herbert Xu
Quoted 4 lines · Mathias Krause

The current code does not set the msg_namelen member to 0 and therefore makes net/socket.c leak the local sockaddr_storage variable to userland -- 128 bytes of kernel stack memory. Fix that.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Patch applied. Thanks!

Thanks, but that patch shouldn't have been applied to cryptodev but crypto instead, and probably queued up for stable as well. I missed the 'Cc: stable # v2.6.38'. My bad.

OK, I'll move it across and add the stable Cc.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#4 lore raw
Quoted 9 lines · Herbert Xu
Quoted 8 lines · Mathias Krause
Quoted 7 lines · Herbert Xu
Quoted 5 lines · Mathias Krause

The current code does not set the msg_namelen member to 0 and therefore makes net/socket.c leak the local sockaddr_storage variable to userland -- 128 bytes of kernel stack memory. Fix that.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Patch applied. Thanks!

Thanks, but that patch shouldn't have been applied to cryptodev but crypto instead, and probably queued up for stable as well. I missed the 'Cc: stable # v2.6.38'. My bad.

OK, I'll move it across and add the stable Cc.

Any specific reason you're not pushing it to Linus for inclusion in v3.9?

Mathias