public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcin Slusarz <marcin.slusarz@gmail.com>
To: "Carlos R. Mafra" <crmafra2@gmail.com>
Cc: Arjan van de Ven <arjan@infradead.org>,
	Arjan van de Ven <arjan@linux.intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [2.6.28-rc1 regression] wmifinfo dockapp takes 100% of cpu (bisected)
Date: Sat, 25 Oct 2008 20:03:27 +0200	[thread overview]
Message-ID: <20081025180322.GA10932@joi> (raw)
In-Reply-To: <20081025162503.GA4001@localhost.aei.mpg.de>

On Sat, Oct 25, 2008 at 06:25:05PM +0200, Carlos R. Mafra wrote:
> On Sat 25.Oct'08 at  7:13:48 -0700, Arjan van de Ven wrote:
> > On Sat, 25 Oct 2008 07:05:42 -0700
> > Arjan van de Ven <arjan@linux.intel.com> wrote:
> > 
> > > Carlos R. Mafra wrote:
> > > 
> > > 
> > > Hi,
> > > 
> > > the line below is the key one:
> > > 
> > > > select(4, [3], NULL, NULL, {0, 5000000}) = -1 EINVAL (Invalid
> > > > argument)
> > > 
> > > the application gives us an invalid timeval; it should have been (5,
> > > 0) However, if the kernel accepted this before the kernel needs to
> > > now also accept it obviously, I'll look into it
> > 
> > This patch should fix it; I'm a bit worried that I need to fix up
> > userlands "mess", but ok. I also checked all other converted functions,
> > and only select has this problem. The problem is that the conversion
> > from microseconds to nanoseconds is overflowing ;-(
> > 
> > can you give this one a test?
> 
> Your patch did not solve it.
> 
> But you are right that the program I use is a mess, it was doing
> 
>     tv.tv_sec = 0;
>     tv.tv_usec = 5000000L;
> 
> So I changed it to
> 
>     tv.tv_sec = 5;
>     tv.tv_usec = 0;
> 
> and it worked (with and without your patch).
> 
> From what I understand this is what your patch does,
> so it is strange that it didn't work...
> 
> > diff --git a/fs/compat.c b/fs/compat.c
> > index fe3c9bf..95ceee6 100644
> > --- a/fs/compat.c
> > +++ b/fs/compat.c
> > @@ -1680,9 +1680,16 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
> >  	int ret;
> >  
> >  	if (tvp) {
> > +		int i;
> >  		if (copy_from_user(&tv, tvp, sizeof(tv)))
> >  			return -EFAULT;
> >  
> > +		while (tv.tv_usec > USEC_PER_SEC && i < 1000) {
                                  ^ 
should be >=

> > +			i++;
> > +			tv.tv_sec ++;
> > +			tv.tv_usec -= USEC_PER_SEC;
> > +		}
> > +
> >  		to = &end_time;
> >  		if (poll_select_set_timeout(to, tv.tv_sec,
> >  					    tv.tv_usec * NSEC_PER_USEC))
> > diff --git a/fs/select.c b/fs/select.c
> > index 448e440..e4e7cdb 100644
> > --- a/fs/select.c
> > +++ b/fs/select.c
> > @@ -515,9 +515,16 @@ asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
> >  	int ret;
> >  
> >  	if (tvp) {
> > +		int i = 0;
> >  		if (copy_from_user(&tv, tvp, sizeof(tv)))
> >  			return -EFAULT;
> >  
> > +		while (tv.tv_usec > USEC_PER_SEC && i < 1000) {

and here too

> > +			i++;
> > +			tv.tv_sec ++;
> > +			tv.tv_usec -= USEC_PER_SEC;
> > +		}
> > +
> >  		to = &end_time;
> >  		if (poll_select_set_timeout(to, tv.tv_sec,
> >  					    tv.tv_usec * NSEC_PER_USEC))
> > 
> > -- 

  reply	other threads:[~2008-10-25 18:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-25  9:40 [2.6.28-rc1 regression] wmifinfo dockapp takes 100% of cpu (bisected) Carlos R. Mafra
2008-10-25 14:05 ` Arjan van de Ven
2008-10-25 14:13   ` Arjan van de Ven
2008-10-25 16:25     ` Carlos R. Mafra
2008-10-25 18:03       ` Marcin Slusarz [this message]
2008-10-25 18:29         ` Carlos R. Mafra
2008-10-25 18:39           ` Marcin Slusarz
2008-10-25 19:12         ` Arjan van de Ven
2008-10-25 19:38           ` Ray Lee
2008-10-30  7:04             ` Andrew Morton

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=20081025180322.GA10932@joi \
    --to=marcin.slusarz@gmail.com \
    --cc=arjan@infradead.org \
    --cc=arjan@linux.intel.com \
    --cc=crmafra2@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