From: Kees Cook <keescook@chromium.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
linux-kernel@vger.kernel.org,
David Daney <ddaney@caviumnetworks.com>
Subject: [PATCH] waitid(): Avoid unbalanced user_access_end() on access_ok() error
Date: Fri, 20 Oct 2017 07:36:05 -0700 [thread overview]
Message-ID: <20171020143605.GA59685@beast> (raw)
As pointed out by Linus and David, the earlier waitid() fix resulted in a
(currently harmless) unbalanced user_access_end() call. This fixes it to
just directly return EFAULT on access_ok() failure.
Fixes: 96ca579a1ecc ("waitid(): Add missing access_ok() checks")
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
This seems best to get fixed up now (in the same release where it was
introduced) before it tries to bite us at some later time.
---
kernel/exit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/exit.c b/kernel/exit.c
index cf28528842bc..f6cad39f35df 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1611,7 +1611,7 @@ SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *,
return err;
if (!access_ok(VERIFY_WRITE, infop, sizeof(*infop)))
- goto Efault;
+ return -EFAULT;
user_access_begin();
unsafe_put_user(signo, &infop->si_signo, Efault);
@@ -1739,7 +1739,7 @@ COMPAT_SYSCALL_DEFINE5(waitid,
return err;
if (!access_ok(VERIFY_WRITE, infop, sizeof(*infop)))
- goto Efault;
+ return -EFAULT;
user_access_begin();
unsafe_put_user(signo, &infop->si_signo, Efault);
--
2.7.4
--
Kees Cook
Pixel Security
next reply other threads:[~2017-10-20 14:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-20 14:36 Kees Cook [this message]
2017-10-20 15:11 ` [PATCH] waitid(): Avoid unbalanced user_access_end() on access_ok() error David Daney
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=20171020143605.GA59685@beast \
--to=keescook@chromium.org \
--cc=ddaney@caviumnetworks.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.