Re: [patch v2] net: heap overflow in __audit_sockaddr()
From: Eric Wong <hidden>
Date: 2013-11-27 11:42:49
Dan Carpenter [off-list ref] wrote:
quoted hunk ↗ jump to hunk
--- a/net/socket.c +++ b/net/socket.c@@ -1964,6 +1964,16 @@ struct used_address { unsigned int name_len; }; +static int copy_msghdr_from_user(struct msghdr *kmsg, + struct msghdr __user *umsg) +{ + if (copy_from_user(kmsg, umsg, sizeof(struct msghdr))) + return -EFAULT; + if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) + return -EINVAL; + return 0;
Crap, this seems to break Ruby trunk :x https://bugs.ruby-lang.org/issues/9124 I'm inclined to think Ruby is wrong to use a gigantic buffer, but this may also break some other existing userspace code. I'm not sure what the best option since breaking userspace (even buggy userspace?) is not taken lightly. Is there a different way to fix this in the kernel? Note: this doesn't affect a stable release of Ruby, yet. (Not a Ruby developer myself, just occasional contributor).