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] [day] [month] [year] [list]
Message-ID: <4AC640CD.2030204@gmail.com>
Date:	Fri, 02 Oct 2009 20:05:01 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Jason Gunthorpe <jgunthorpe@...idianresearch.com>
CC:	Volker Lendecke <Volker.Lendecke@...Net.DE>,
	netdev@...r.kernel.org, Volker Lendecke <vl@...ba.org>
Subject: Re: Splice on blocking TCP sockets again..

Jason Gunthorpe a écrit :

> 
> I'd suggest a construct like the following as a compatability
> solution:
> 
> struct pollfd pfd = {.fd = tcpfd, events = POLLIN | POLLRDHUP};
> while (..) {
>    rc = splice(tcpfd,0,pfd[1],0,count,SPLICE_F_MOVE | SPLICE_F_NONBLOCK);
>    if (rc == -1)
>      //...
>    if (rc == 0) {
>        if (pfd.revents & POLLRDHUP)
>           // oops, EOF on TCP
> 
>        /* Might be an old kernel that nonblocks on TCP, have to check
>           if this is EOF or do blocking. */
>        rc = poll(&pfd,1,-1);
>        if (rc == -1)
>           //...
>    }
> 
>    rc = splice(pfd[0],0,ofd,0,..., SPLICE_F_MOVE)
> }
> 
> Which should add no overhead in the new splice blocks case, and falls
> back gracefully on older kernels..
> 

Agreed, thanks for the tip.

Indeed, new kernel will permit a loop with only splice() syscalls, while on an old
kernel, some poll() syscalls might be needed if tcp socket is empty.


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