Re: [PATCH] epoll_[p]wait: fix spurious -EINTR on ptrace attach

From: Oleg Nesterov
Date: Tue Jun 25 2013 - 14:50:49 EST


On 06/25, Denys Vlasenko wrote:
>
> Before this change, epoll_wait and epoll_pwait
> spuriously return with -EINTR on ptrace attach.
>
> By analogy with poll syscall family, epoll_[p]wait should be interruptible
> by signals regardless of SA_RESTART, therefore, this change
> makes them return -ERESTARTNOHAND if timeout has expired.

Denys, I am not even going to actuallu read this patch, but I think
you should redo it in any case... And you need to cc maintainers.

Because I believe we should cleanup fs/eventpoll.c first, I'll try
to send the patch(es) soon.

> In order to define a "sigset_t ksigmask" member,

You do not need it. But the reason is not clear until the cleanup.

> + if (sigmask) {
> + ksigmask = *sigmask;
> + sigdelsetmask(&ksigmask, sigmask(SIGKILL) | sigmask(SIGSTOP));
> + sigprocmask(SIG_SETMASK, &ksigmask, &ksigsaved);

sigprocmask() should not be used. Again, we need cleanup.

> + }
> + else
> + /*
> + * If we changed the signal mask, we need to restore the original one.
> + */
> + if (sigmask) {
> + sigprocmask(SIG_SETMASK, &ksigsaved, NULL);
> + }

cough.. in this case you should also update Documentation/CodingStyle ;)

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/