[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1372087913-7854-1-git-send-email-dvlasenk@redhat.com>
Date: Mon, 24 Jun 2013 17:31:53 +0200
From: Denys Vlasenko <dvlasenk@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: Denys Vlasenko <dvlasenk@...hat.com>,
Oleg Nesterov <oleg@...hat.com>
Subject: [PATCH] epoll_wait: fix EINTR leak
Usage of EINTR is wrong. For one, it causes epoll_wait
to spuriously return with EINTR on ptrace attach.
One of ERESTARTfoo's should be used.
By analogy with poll syscall family, epoll_wait should be interrupted
by signals regardless of SA_RESTART, thus ERESTARTNOHAND is used,
not ERESTARTSYS.
Signed-off-by: Denys Vlasenko <dvlasenk@...hat.com>
CC: Oleg Nesterov <oleg@...hat.com>
---
fs/eventpoll.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 0cff4434..08f8076 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1598,7 +1598,7 @@ fetch_events:
if (ep_events_available(ep) || timed_out)
break;
if (signal_pending(current)) {
- res = -EINTR;
+ res = -ERESTARTNOHAND;
break;
}
@@ -1990,7 +1990,7 @@ 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) {
+ if (error == -ERESTARTNOHAND) {
memcpy(¤t->saved_sigmask, &sigsaved,
sizeof(sigsaved));
set_restore_sigmask();
@@ -2035,7 +2035,7 @@ COMPAT_SYSCALL_DEFINE6(epoll_pwait, int, epfd,
* the way back to userspace, before the signal mask is restored.
*/
if (sigmask) {
- if (err == -EINTR) {
+ if (err == -ERESTARTNOHAND) {
memcpy(¤t->saved_sigmask, &sigsaved,
sizeof(sigsaved));
set_restore_sigmask();
--
1.8.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists