From: Willy Tarreau <w@1wt.eu>
To: Solar Designer <solar@openwall.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] getsockopt() early argument sanity checking
Date: Sun, 20 Aug 2006 01:48:06 +0200 [thread overview]
Message-ID: <20060819234806.GB27115@1wt.eu> (raw)
In-Reply-To: <20060819230532.GA16442@openwall.com>
On Sun, Aug 20, 2006 at 03:05:32AM +0400, Solar Designer wrote:
> Willy,
>
> I propose the attached patch (extracted from 2.4.33-ow1) for inclusion
> into 2.4.34-pre.
>
> (2.6 kernels could benefit from the same change, too, but at the moment
> I am dealing with proper submission of generic changes like this that
> are a part of 2.4.33-ow1.)
>
> The patch makes getsockopt(2) sanity-check the value pointed to by
> the optlen argument early on. This is a security hardening measure
> intended to prevent exploitation of certain potential vulnerabilities in
> socket type specific getsockopt() code on UP systems.
>
> This change has been a part of -ow patches for some years.
looks valid to me, merged.
Thanks Alexander !
Willy
> Thanks,
>
> --
> Alexander Peslyak <solar at openwall.com>
> GPG key ID: B35D3598 fp: 6429 0D7E F130 C13E C929 6447 73C3 A290 B35D 3598
> http://www.openwall.com - bringing security into open computing environments
> diff -urpPX nopatch linux-2.4.33/net/socket.c linux/net/socket.c
> --- linux-2.4.33/net/socket.c Wed Jan 19 17:10:14 2005
> +++ linux/net/socket.c Sat Aug 12 08:51:47 2006
> @@ -1307,10 +1307,18 @@ asmlinkage long sys_setsockopt(int fd, i
> asmlinkage long sys_getsockopt(int fd, int level, int optname, char *optval, int *optlen)
> {
> int err;
> + int len;
> struct socket *sock;
>
> if ((sock = sockfd_lookup(fd, &err))!=NULL)
> {
> + /* XXX: insufficient for SMP, but should be redundant anyway */
> + if (get_user(len, optlen))
> + err = -EFAULT;
> + else
> + if (len < 0)
> + err = -EINVAL;
> + else
> if (level == SOL_SOCKET)
> err=sock_getsockopt(sock,level,optname,optval,optlen);
> else
next prev parent reply other threads:[~2006-08-19 23:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-19 23:05 [PATCH] getsockopt() early argument sanity checking Solar Designer
2006-08-19 23:48 ` Willy Tarreau [this message]
2006-08-20 0:05 ` Michael Buesch
2006-08-20 0:43 ` Willy Tarreau
2006-08-20 19:44 ` David Miller
2006-08-20 20:35 ` Willy Tarreau
2006-08-20 21:12 ` Arjan van de Ven
2006-08-21 12:09 ` Eugene Teo
2006-08-20 8:34 ` Andi Kleen
2006-08-20 10:15 ` Willy Tarreau
2006-08-20 10:50 ` YOSHIFUJI Hideaki / 吉藤英明
2006-08-20 19:46 ` David Miller
2006-08-20 16:16 ` Solar Designer
2006-08-20 16:30 ` Arjan van de Ven
2006-08-20 19:47 ` David Miller
2006-08-20 18:38 ` Andi Kleen
2006-08-20 19:45 ` Solar Designer
2006-08-20 19:45 ` David Miller
2006-08-20 18:15 ` Alan Cox
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=20060819234806.GB27115@1wt.eu \
--to=w@1wt.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=solar@openwall.com \
/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).