Re: [PATCH 3/4] Consolidate sys32 select

From: Arnd Bergmann
Date: Thu May 27 2004 - 08:42:25 EST


On Wednesday 26 May 2004 08:09, Martin Josefsson wrote:

> Your patch will fix the problem, I don't even need to test it.
> Thanks, looking forward to see a fix in mainline :)

I have thought about it again and am no longer sure it is really
the right fix. Can anyone explain why this problem only happens
for the fifth argument, but not for the other pointers (inp, outp,
exp)?

If sparc64 has this problem only for the fifth syscall argument,
does that mean that e.g. compat_sys_futex and
compat_sys_mq_timed{send,receive} have the same bug? If this is
a more general, i.e. not limited to the last argument, there is a
potential problem in lots of syscalls.

Arnd <><

> > ===== fs/compat.c 1.24 vs edited =====
> > --- 1.24/fs/compat.c  Sat May 22 06:31:47 2004
> > +++ edited/fs/compat.c        Wed May 26 00:57:49 2004
> > @@ -1300,13 +1300,15 @@
> >  
> >  asmlinkage long
> >  compat_sys_select(int n, compat_ulong_t __user *inp, compat_ulong_t
> > __user *outp,
> > -             compat_ulong_t __user *exp, struct compat_timeval __user *tvp)
> > +             compat_ulong_t __user *exp, compat_uptr_t utv)
> >  {
> >       fd_set_bits fds;
> > +     struct compat_timeval __user *tvp;
> >       char *bits;
> >       long timeout;
> >       int ret, size, max_fdset;
> >  
> > +     tvp = compat_ptr(utv);
> >       timeout = MAX_SCHEDULE_TIMEOUT;
> >       if (tvp) {
> >               time_t sec, usec;

Attachment: pgp00000.pgp
Description: signature