Re: pselect/etc semantics (Was: [PATCH v2] signal: Adjust error codes according to restore_user_sigmask())

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 30, 2019 at 4:41 PM Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> On 05/30, Arnd Bergmann wrote:
> Plus every file touched by this patch asks for more cleanups. Say, do_poll()
> should return -ERESTARTNOHAND, not -EINTR, after that we can remove the ugly
> EINTR->ERESTARTNOHAND in its callers. And more.
>
> > For the stable
> > kernels, I think we want just the addition of the 'bool interrupted' argument
> > to restore_user_sigmask()
>
> or simply revert this patch. I will check if this is possible today... At first
> glance 854a6ed56839a40f6 fixed another bug by accident, do_pselect() did
> "ret == -ERESTARTNOHAND" after "ret = poll_select_copy_remaining()" which can
> turn ERESTARTNOHAND into EINTR, but this is simple. I'll check tomorrow.

Right, there were several differences between the system calls
that Deepa's original change got rid of. I don't know if any ones besides
the do_pselect() return code can be observed in practice.

> > > -       ret = set_user_sigmask(ksig.sigmask, &ksigmask, &sigsaved, ksig.sigsetsize);
> > > +       ret = set_xxx(ksig.sigmask, ksig.sigsetsize);
> > >         if (ret)
> > >                 return ret;
> > >
> > >         ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &ts : NULL);
> > > -       restore_user_sigmask(ksig.sigmask, &sigsaved);
> > > -       if (signal_pending(current) && !ret)
> > > +
> > > +       interrupted = signal_pending(current);
> > > +       update_xxx(interrupted);
> >
> > Maybe name this
> >
> >            restore_saved_sigmask_if(!interrupted);
>
> Yes, I thought about restore_if(), but to me
>
>                 restore_saved_sigmask_if(ret != -EINTR);
>
> doesn't look readable... May be
>
>                 restore_saved_sigmask_unless(ret == -EINTR);
>
> ? but actually I agree with any naming.

Yes, restore_saved_sigmask_unless() probably better.

> > With some of the recent discussions about compat syscall handling,
> > I now think that we want to just fold set_compat_user_sigmask()
> > into set_user_sigmask()
>
> agreed, and I thought about this too. But again, I'd prefer to do this
> and other cleanups later, on top of this patch.

Ok, fair enough. I don't care much about the order as long as the
regression fix comes first.

     Arnd



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux