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

Alan Cox wrote:

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

Given that the current, sole purpose of sys_poll() is to implement the 
poll(2)
system call, and that currently, that system call takes a 32 bit signed 
integer
third argument, then it seems safe to me to just ignore the top 32 
bits.  They
can be either masked off explicitly or implicitly via the use of a 32 bit
signed integer.

Is there a problem with making this change other than it is a change?  Is
there a risk of something breaking?

    Thanx...

       ps

      reply	other threads:[~2005-11-11 13:17 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
2005-11-11 13:17           ` Peter Staubach [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=437499F2.1040708@redhat.com \
    --to=staubach@redhat.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=drepper@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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