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:	Fri, 3 Jul 2009 09:55:54 +0800
From:	Amerigo Wang <xiyou.wangcong@...il.com>
To:	Changli Gao <xiaosuo@...il.com>
Cc:	Amerigo Wang <xiyou.wangcong@...il.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: PROPOSAL: extend pipe() to support NULL argument.

On Fri, Jul 03, 2009 at 08:43:39AM +0800, Changli Gao wrote:
>On Thu, Jul 2, 2009 at 6:21 PM, Amerigo Wang<xiyou.wangcong@...il.com> wrote:
>> On Thu, Jul 02, 2009 at 06:04:02PM +0800, Changli Gao wrote:
>>>On Thu, Jul 2, 2009 at 5:46 PM, Amerigo Wang<xiyou.wangcong@...il.com> wrote:
>>>>>Are you familiar with splice() and tee()? They both use pipes as kernel buffers.
>>>>
>>>> You are not answering the question, obviously.
>>>When you use pipes as kernel buffer handlers, two fd isn't necessary.
>>>Using one will save half of fd resources. Is it obviously?
>>
>> Not really.. I can't see any reason why you use this method to save
>> fd's... pick read(2)/write(2).
>In order to use splice, you must have pipe first. The common code is:
>
>int fd[2];
>
>pipe(fd);
>splice(infd, NULL, fd[1], NULL, getpagesize(), SPLICE_F_MOVE);
>splice(fd[0], NULL, outfd, NULL, getpagesize(), SPLICE_F_MOVE);
>close(fd[0]);
>close(fd[1]);
>
>if pipe supports NULL argument, and returnes a RW pipe fd in that
>case, the code will become:
>
>int fd;
>
>fd = pipe(NULL);
>splice(infd, NULL, fd, NULL, getpagesize(), SPLICE_F_MOVE);
>splice(fd, NULL, outfd, NULL, getpagesize(), SPLICE_F_MOVE);
>close(fd);
>
>One fd is saved.


What is a pipe in your mind? A pipe has two points, obviously,
you are making it a single point, thus you can't call it a pipe
any more...

I don't like this.

And just as what you showed above, you can close the fd's
after finishing, thus you only save one fd during these
two splice(), not useful...


>>
>> You are trying to break it...
>>
>
>It depends on the argument for pipe, if the argument is NULL, it
>breaks the code above.
>

Sure, malloc(2) can return NULL.

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