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: <1308721360.2713.5.camel@edumazet-laptop>
Date:	Wed, 22 Jun 2011 07:42:40 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Paul Gortmaker <paul.gortmaker@...driver.com>
Cc:	davem@...emloft.net, netdev@...r.kernel.org,
	Xufeng Zhang <xufeng.zhang@...driver.com>
Subject: Re: [PATCH net-next 2/3] ipv6/udp: Use the correct variable to
 determine non-blocking condition

Le mardi 21 juin 2011 à 16:43 -0400, Paul Gortmaker a écrit :
> From: Xufeng Zhang <xufeng.zhang@...driver.com>
> 
> udpv6_recvmsg() function is not using the correct variable to determine
> whether or not the socket is in non-blocking operation, this will lead
> to unexpected behavior when a UDP checksum error occurs.
> 
> Consider a non-blocking udp receive scenario: when udpv6_recvmsg() is
> called by sock_common_recvmsg(), MSG_DONTWAIT bit of flags variable in
> udpv6_recvmsg() is cleared by "flags & ~MSG_DONTWAIT" in this call:
> 
>     err = sk->sk_prot->recvmsg(iocb, sk, msg, size, flags & MSG_DONTWAIT,
>                    flags & ~MSG_DONTWAIT, &addr_len);
> 
> i.e. with udpv6_recvmsg() getting these values:
> 
> 	int noblock = flags & MSG_DONTWAIT
> 	int flags = flags & ~MSG_DONTWAIT
> 
> So, when udp checksum error occurs, the execution will go to
> csum_copy_err, and then the problem happens:
> 
>     csum_copy_err:
>             ...............
>             if (flags & MSG_DONTWAIT)
>                     return -EAGAIN;
>             goto try_again;
>             ...............
> 
> But it will always go to try_again as MSG_DONTWAIT has been cleared
> from flags at call time -- only noblock contains the original value
> of MSG_DONTWAIT, so the test should be:
> 
>             if (noblock)
>                     return -EAGAIN;
> 
> This is also consistent with what the ipv4/udp code does.
> 
> Signed-off-by: Xufeng Zhang <xufeng.zhang@...driver.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@...driver.com>
> ---

Acked-by: Eric Dumazet <eric.dumazet@...il.com>


--
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