Re: pselect/etc semantics

From: Eric W. Biederman
Date: Thu May 30 2019 - 09:08:50 EST


Eric Wong <e@xxxxxxxxx> writes:

> Agreed... I believe cmogstored has always had a bug in the way
> it uses epoll_pwait because it failed to check interrupts if:
>
> a) an FD is ready + interrupt
> b) epoll_pwait returns 0 on interrupt
>
> The bug remains in userspace for a), which I will fix by adding
> an interrupt check when an FD is ready. The window is very
> small for a) and difficult to trigger, and also in a rare code
> path.
>
> The b) case is the kernel bug introduced in 854a6ed56839a40f
> ("signal: Add restore_user_sigmask()").
>
> I don't think there's any disagreement that b) is a kernel bug.

See my reply to Oleg. I think (b) is a regression that needs to be
fixed. I do not think that (b) is a kernel bug. Both versions of the
of what sigmask means posix and naive will allow (b).

Because fundamentally the sigmask is restored after the rest of the
system call happens.

Eric