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: <7a0033e7db3f4acb9d70b173d063b4d2@AcuMS.aculab.com>
Date:   Sat, 18 Mar 2023 12:40:01 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'richard clark' <richard.xnu.clark@...il.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: Question about select and poll system call

> On Fri, Mar 17, 2023 at 2:15 AM Linus Torvalds
> <torvalds@...ux-foundation.org> wrote:
> >
...
> > And back then, we had this:
> >
> >   typedef unsigned long fd_set;
> >
> > which may seem a bit limiting today ("Only 32 bits??!?"), but to put
> > that in perspective, back then we also had this:
> >
> >   #define NR_OPEN 20

That is the historic limit for SYSV (and probably BSD).
I suspect you just copied it.
Quite why it was 20 and not 16 or 32 I don't know.
But 20 open files was assumed to be 'plenty'!

The first SYSV kernel that supported fd >= 20 actually used
a linked list to hold the internal data (mostly a pointer).

So accessing a big fd number was O(fd).
Calling poll() O(numfd**2) and getting that many open sockets
in a network server process O(n**3).

Don't even think about how slowly a process trying to
use 2000 sockets was!

The 20 fd limit also made them a limited resource.
Demons couldn't really afford to dup() /dev/null onto 0, 1 and 2,
instead they'd just close the fd.
An accidental printf() that should have been sprintf() then
slowly fills the stdout buffer, when that eventually fills
the write to fd 1 has side effects that are rather difficult
to debug.
(Someone should have noticed that the tracing was incorrect)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ