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

From: Oleg Nesterov
Date: Tue Jun 25 2013 - 16:10:47 EST


On 06/25, Oleg Nesterov wrote:
>
> 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.

Yes... but when I look at it again I think that "timeout" logic is
still wrong.

restart_block->epoll.timeout = rem_msec;

this obviously means the remaining timeout, yes?

If yes, this is not right. Suppose that we return ERESTART_RESTARTBLOCK
due to SIGSTOP. The task can sleep in TASK_STOPPED "forever", we should
not restart with "timeout = rem_msec" after that.

You need the end_time logic like sys_poll() does.

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

Please see the patches I sent.

> > In order to define a "sigset_t ksigmask" member,
>
> You do not need it. But the reason is not clear until the cleanup.

I take this back, this is not as simple as I thought... and perhaps even
not right.

However. Probably you can replace has_ksigmask + ksigmask by
"sigset_t __user *sigmask" pointer?

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/