mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Vadim Lobanov <vlobanov@speakeasy.net>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix poll() nfds check.
Date: Thu, 06 Jul 2006 20:00:43 -0700	[thread overview]
Message-ID: <44ADCE5B.9040907@zytor.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0607051949460.6604@shell3.speakeasy.net>

Vadim Lobanov wrote:
> Hi,
> 
> This is a trivial patch to fix the nfds check in the poll system call
> implementation. Namely, OPEN_MAX no longer does anything important in
> the kernel, and checking that nfds is greater than max_fdset AND greater
> than OPEN_MAX therefore just seems wrong.
> 
> This brings up a slightly-tangential question: Why do the nfds checks
> exist in select()/poll()? They're not strictly necessary, since bad
> input will be caught later when we validate all the fds, one by one.
> Furthermore, these checks optimize the handling of error cases (which
> should be uncommon) while pessimizing correct usage of the syscalls
> (which should be more common).
> 

The reason for these is presumably to keep applications which uses 
select() to overflow their fd_sets.  Unfortunately fd_set is defined in 
such a way that it's a static size.

Using ulimit seems like a reasonable compromise for this.

	-hpa

      parent reply	other threads:[~2006-07-07  3:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-06  3:00 Vadim Lobanov
2006-07-06  3:39 ` Andrew Morton
2006-07-06  4:02   ` Vadim Lobanov
2006-07-06 15:44   ` Ulrich Drepper
2006-07-06 16:28     ` Vadim Lobanov
2006-07-07  3:00 ` H. Peter Anvin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44ADCE5B.9040907@zytor.com \
    --to=hpa@zytor.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vlobanov@speakeasy.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome