public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Ulrich Drepper <drepper@gmail.com>
Cc: Peter Staubach <staubach@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] poll(2) timeout values
Date: Fri, 11 Nov 2005 13:16:07 +0000	[thread overview]
Message-ID: <1131714967.3174.9.camel@localhost.localdomain> (raw)
In-Reply-To: <a36005b50511101649l744f78c1i76133434be7304e8@mail.gmail.com>

On Iau, 2005-11-10 at 16:49 -0800, Ulrich Drepper wrote:
> On 11/10/05, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> > No. The poll POSIX libc call takes an int. What the kernel ones does
> > with the top bits is irrelevant to applications.
> 
> The issue is that if the high bits are not handled special then
> somebody might cause problems.  E.g., overflowing the division or so. 
> Therefore the kernel has to sanitize the argument and then why not use
> the easiest way to do this?

Why does the kernel have to sanitize the input. Last time I checked
undefined inputs gave undefined outputs in the standards. fopen(NULL,
NULL) seems to crash glibc for example.

The kernel has to behave correctly given valid sensible inputs. Masking
the top bits is not behaving correctly

	"sleep ages"
	"no I'll sleep a short time"

Surely it would be far better to do

	if((timeout >> 31) >> 1) 
		return -EINVAL;

for 64bit systems


  parent reply	other threads:[~2005-11-11 12:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-10 16:31 [PATCH] poll(2) timeout values Peter Staubach
2005-11-10 17:15 ` Alan Cox
2005-11-10 21:02   ` Willy Tarreau
2005-11-11 20:19     ` Peter Staubach
2005-11-11 22:02       ` Willy Tarreau
     [not found]   ` <a36005b50511101049vf20cde5m9385c433e18dcd2d@mail.gmail.com>
2005-11-10 22:33     ` Alan Cox
     [not found]       ` <a36005b50511101649l744f78c1i76133434be7304e8@mail.gmail.com>
2005-11-11 13:16         ` Alan Cox [this message]
2005-11-11 13:17           ` Peter Staubach

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=1131714967.3174.9.camel@localhost.localdomain \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=drepper@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=staubach@redhat.com \
    /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