lkml.org 
[lkml]   [2013]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] signals: eventpoll: set ->saved_sigmask at the start
On Tue, Jun 25, 2013 at 09:57:59PM +0200, Oleg Nesterov wrote:
> + current->saved_sigmask = current->blocked;
> set_current_blocked(&ksigmask);
> }
>
> error = sys_epoll_wait(epfd, events, maxevents, timeout);
> -
> /*
> * If we changed the signal mask, we need to restore the original one.
> * In case we've got a signal while waiting, we do not restore the
> @@ -1988,12 +1988,10 @@ SYSCALL_DEFINE6(epoll_pwait, int, epfd, struct epoll_event __user *, events,
> * the way back to userspace, before the signal mask is restored.
> */
> if (sigmask) {
> - if (error == -EINTR) {
> - memcpy(&current->saved_sigmask, &sigsaved,
> - sizeof(sigsaved));
> + if (error == -EINTR)
> set_restore_sigmask();
> - } else
> - set_current_blocked(&sigsaved);
> + else
> + __set_current_blocked(&current->saved_sigmask);

I don't like that. If anything, we have
static inline void restore_saved_sigmask(void)
{
if (test_and_clear_restore_sigmask())
__set_current_blocked(&current->saved_sigmask);
}
which means that the last part can be turned into
set_restore_sigmask();
if (error != -EINTR)
restore_saved_sigmask();
and I'd pulled set_restore_sigmask() call next to setting the sucker.


\
 
 \ /
  Last update: 2013-06-25 23:01    [W:0.042 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site