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: <Pine.LNX.4.64.0802271131180.377@alien.or.mcafeemobile.com>
Date:	Wed, 27 Feb 2008 11:35:11 -0800 (PST)
From:	Davide Libenzi <davidel@...ilserver.org>
To:	Chris "ク" Heath <chris@...thens.co.nz>
cc:	Michael Kerrisk <mtk.manpages@...glemail.com>,
	David Schwartz <davids@...master.com>, dada1@...mosbay.com,
	"Linux-Kernel@...r. Kernel. Org" <linux-kernel@...r.kernel.org>,
	linux-man@...r.kernel.org
Subject: Re: epoll design problems with common fork/exec patterns

On Tue, 26 Feb 2008, Chris "ã~B¯" Heath wrote:

> On Tue, 2008-02-26 at 10:51 -0800, Davide Libenzi wrote:
> > 
> > Yes, you can't add the same fd twice. Think about a DB where "file*,fd" is 
> > the key.
> 
> To clarify, the key appears to be file* plus the user-space integer that
> represents the fd.

Yes, that's what I said.



> > > c) It is possible to add duplicated file descriptors referring to the same
> > > underlying open file description ("file *").  As you note, this can be a
> > > useful filtering technique, if the two file descriptors specify different
> > > masks.
> > > 
> > > Assuming that is all correct, for man-pages-2.79, I've reworked the text
> > > for Q1/A1 as follows:
> > > 
> > >        Q1     What  happens  if you add the same file descriptor
> > >               to an epoll set twice?
> > > 
> > >        A1     You will probably get EEXIST.  However, it is pos-
> > >               sible   to   add  a  duplicate  (dup(2),  dup2(2),
> > >               fcntl(2) F_DUPFD, fork(2)) descriptor to the  same
> > >               epoll  set.   This  can  be a useful technique for
> > >               filtering events, if the duplicate  file  descrip-
> > >               tors are registered with different events masks.
> > > 
> > > Seem okay Davide?
> > 
> > Looks sane to me.
> 
> I think fork(2) should not be in the above list.  fork(2) duplicates the
> kernel's fd, but the user-space integer that represents the fd remains
> the same, so you will get EEXIST if you try to add the fd that was
> duplicated by fork.

Good catch, fork(2) should not be there.



- Davide


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ