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]
Date:	Sun, 5 Oct 2008 16:45:57 -0500
From:	swivel@...lls.gnugeneration.com
To:	David Miller <davem@...emloft.net>
Cc:	alan@...rguk.ukuu.org.uk, linux-kernel@...r.kernel.org
Subject: Re: Honoring SO_RCVLOWAT in proto_ops.poll methods

On Sun, Oct 05, 2008 at 01:27:22PM -0700, David Miller wrote:
> 
> Give this patch a try:
> 
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 1ab341e..0e43875 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -384,13 +384,17 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
>  
>  	/* Connected? */
>  	if ((1 << sk->sk_state) & ~(TCPF_SYN_SENT | TCPF_SYN_RECV)) {
> +		int target = sock_rcvlowat(sk, 0, INT_MAX);
> +
> +		if (tp->urg_seq == tp->copied_seq &&
> +		    !sock_flag(sk, SOCK_URGINLINE) &&
> +		    tp->urg_data)
> +			target--;
> +
>  		/* Potential race condition. If read of tp below will
>  		 * escape above sk->sk_state, we can be illegally awaken
>  		 * in SYN_* states. */
> -		if ((tp->rcv_nxt != tp->copied_seq) &&
> -		    (tp->urg_seq != tp->copied_seq ||
> -		     tp->rcv_nxt != tp->copied_seq + 1 ||
> -		     sock_flag(sk, SOCK_URGINLINE) || !tp->urg_data))
> +		if (target >= tp->rcv_nxt - tp->copied_seq)
>  			mask |= POLLIN | POLLRDNORM;
>  
>  		if (!(sk->sk_shutdown & SEND_SHUTDOWN)) {


I will be testing this patch today.  At a glance it appears with this
patch we're still not taking rcvlowat into consideration in recv()
with MSG_PEEK flag set.  This should probably also be corrected, as
mentioned in the thread previously.

Regards,
Vito Caputo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ