From: Denys Vlasenko <dvlasenk@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Denys Vlasenko <dvlasenk@redhat.com>, Oleg Nesterov <oleg@redhat.com>
Subject: [PATCH] epoll_wait: fix EINTR leak
Date: Mon, 24 Jun 2013 17:31:53 +0200 [thread overview]
Message-ID: <1372087913-7854-1-git-send-email-dvlasenk@redhat.com> (raw)
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@redhat.com>
CC: Oleg Nesterov <oleg@redhat.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
next reply other threads:[~2013-06-24 15:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-24 15:31 Denys Vlasenko [this message]
2013-06-24 17:08 ` Oleg Nesterov
2013-06-24 18:39 ` Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1372087913-7854-1-git-send-email-dvlasenk@redhat.com \
--to=dvlasenk@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®