From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755214AbdJLVbM (ORCPT ); Thu, 12 Oct 2017 17:31:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:55092 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753282AbdJLVbK (ORCPT ); Thu, 12 Oct 2017 17:31:10 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Salls , Kees Cook , Al Viro , Linus Torvalds Subject: [PATCH 4.13 2/2] waitid(): Add missing access_ok() checks Date: Thu, 12 Oct 2017 23:26:03 +0200 Message-Id: <20171012212538.767737378@linuxfoundation.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171012212538.671181286@linuxfoundation.org> References: <20171012212538.671181286@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kees Cook commit 96ca579a1ecc943b75beba58bebb0356f6cc4b51 upstream. Adds missing access_ok() checks. CVE-2017-5123 Reported-by: Chris Salls Signed-off-by: Kees Cook Acked-by: Al Viro Fixes: 4c48abe91be0 ("waitid(): switch copyout of siginfo to unsafe_put_user()") Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- kernel/exit.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1611,6 +1611,9 @@ SYSCALL_DEFINE5(waitid, int, which, pid_ if (!infop) return err; + if (!access_ok(VERIFY_WRITE, infop, sizeof(*infop))) + goto Efault; + user_access_begin(); unsafe_put_user(signo, &infop->si_signo, Efault); unsafe_put_user(0, &infop->si_errno, Efault); @@ -1736,6 +1739,9 @@ COMPAT_SYSCALL_DEFINE5(waitid, if (!infop) return err; + if (!access_ok(VERIFY_WRITE, infop, sizeof(*infop))) + goto Efault; + user_access_begin(); unsafe_put_user(signo, &infop->si_signo, Efault); unsafe_put_user(0, &infop->si_errno, Efault);