lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1293554655.20573.5.camel@edumazet-laptop>
Date:	Tue, 28 Dec 2010 17:44:15 +0100
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Jan Engelhardt <jengelh@...ozas.de>
Cc:	Linux Networking Developer Mailing List <netdev@...r.kernel.org>,
	"David S. Miller" <davem@...emloft.net>
Subject: Re: [patch] net/unix: do not forget to autobind in standard case

Le samedi 25 décembre 2010 à 01:08 +0100, Jan Engelhardt a écrit :
> parent 67514fc40bbec857018cbc689d440282b75551db (v2.6.37-rc1-229-g67514fc)
> commit 973bdc63c6aba703dd7b62a6ec7ae4bab7847731
> Author: Jan Engelhardt <jengelh@...ozas.de>
> Date:   Sat Dec 25 00:50:59 2010 +0100
> 
> net/unix: do not forget to autobind in standard case
> 
> A program using recvmsg on an AF_LOCAL datagram socket does not
> receive the peer's address when the remote has not issued a bind. This
> makes it impossible to send messages back. (But the same _does_ work
> in IP.) The cause for this is because autobinding was only done when
> credential passing was requested.
> 

It would be good you did some research and tell us why current code
tests SOCK_PASSCRED

There must be a reason this restrictive code is here, dont you think ?

> --->8---
> 
> Signed-off-by: Jan Engelhardt <jengelh@...ozas.de>
> ---
>  net/unix/af_unix.c |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index 7ff31c6..945797c 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -964,8 +964,8 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
>  			goto out;
>  		alen = err;
>  
> -		if (test_bit(SOCK_PASSCRED, &sock->flags) &&
> -		    !unix_sk(sk)->addr && (err = unix_autobind(sock)) != 0)
> +		if (unix_sk(sk)->addr == NULL &&
> +		    (err = unix_autobind(sock)) != 0)
>  			goto out;
>  
>  restart:
> @@ -1063,8 +1063,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
>  		goto out;
>  	addr_len = err;
>  
> -	if (test_bit(SOCK_PASSCRED, &sock->flags) && !u->addr &&
> -	    (err = unix_autobind(sock)) != 0)
> +	if (u->addr == NULL && (err = unix_autobind(sock)) != 0)
>  		goto out;
>  
>  	timeo = sock_sndtimeo(sk, flags & O_NONBLOCK);
> @@ -1419,8 +1418,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
>  			goto out;
>  	}
>  
> -	if (test_bit(SOCK_PASSCRED, &sock->flags) && !u->addr
> -	    && (err = unix_autobind(sock)) != 0)
> +	if (u->addr == NULL && (err = unix_autobind(sock)) != 0)
>  		goto out;
>  
>  	err = -EMSGSIZE;


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ