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]
Date:	Wed, 23 Sep 2009 09:33:24 +0200
From:	Enrik Berkhan <Enrik.Berkhan@...com>
To:	Марк Коренберг 
	<socketpair@...il.com>
CC:	linux-kernel@...r.kernel.org
Subject: Re: splice between non-pipe (tcp socket) fds

Марк Коренберг wrote:
> I want splice() to work with two tcp sockets().I think to implement
> this. Two questions:

This works already by introducing a pipe between the two:

while (0 < (len = splice(sock1, 0, pipe, 0, max_len, some_flags)))
   splice(pipe, 0, sock2, 0, len, some_flags);

Just like with read(2) and write(2), but without copy to/from userspace.

> 1. Is any work in this direction?
> 2. Why this functionality does not implemented now? any difficulties?
> 
> I think API should consist of 2 main functions:
> 1. detach available buffers from fd1 (and save info in some struct)
> 2. attach buffers to fd2 (from this struct)
> this functions should be called under some lock to guarantee
> atomicity. if something happen, return buffers back to original file.

What about full duplex?

> At now, I think that the most quick way to acheive my results,  is to
> create intermediate temporary pipe inside kernel and splice from
> non-pipe fd to pipe, and than from pipe to second non-pipe fd.

Have a look at the "sendfile emulation" in fs/splice.c. Maybe you can
generalize that in some way or the other.

Enrik

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