From patchwork Fri Jul 15 21:44:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9232815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6FF2060865 for ; Fri, 15 Jul 2016 21:47:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60CD026D08 for ; Fri, 15 Jul 2016 21:47:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54ACA27BF9; Fri, 15 Jul 2016 21:47:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0D93026D08 for ; Fri, 15 Jul 2016 21:47:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bOAvN-00033b-Ei; Fri, 15 Jul 2016 21:45:33 +0000 Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bOAul-0001dc-0L for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2016 21:44:57 +0000 Received: by mail-pa0-x22f.google.com with SMTP id ks6so42721738pab.0 for ; Fri, 15 Jul 2016 14:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iXx//qSV5GUyDsDz5gFTndX/uYBQ8OgROByi4RwfXtY=; b=ohTR354RuaBZcNOodItIkKPTjnQx9HFFZTvrBcLbfaOM3Glfl91Mw/xtuYd8yXrZfs G8+xv851yfAemsFLFzMQQtPg+IuTAR5QdZg09/jU70e+GhUZgv/F3bdrG/8CGVvTLnU3 2hXIL9gm1uqcEvjcyM+Gd07/bW97nUX3pgss0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iXx//qSV5GUyDsDz5gFTndX/uYBQ8OgROByi4RwfXtY=; b=QUSGKzFmLmJnsemWddio92URTcm1Wo3BD3NdlP0o/gJ1GH835QvV9KDT0QycMV5JeY FblmIY+X81BMK6WqOxWWAMn/Zux3boDY5ewFXd9YYUH2+yPRFQSSu9DiwUCDPLCgDrGd QrJWcUjCRn6aZMomctVqFy6B80hTDOtTdDWcjqGPdDJSQQiAR7PZyIDKSCUpiyG4OGrS 9qjj+bxxE7YirRTE90UXfnEdC4tuw5bOp7oCkEaVIRqxQ83sdZ4kcYX7WFqmQDuk8pNk jBpV3wtZUY2i3g/9nkLlFVLGuV43mfw4hofdRJeyAsZjAj6VAbTIFp/YmzjBa7qWTVie z5/A== X-Gm-Message-State: ALyK8tJkM+S7M1Semw5dadQjG1zyqorRfPiefApsI1d+Bj1tfUH4wZhzFeu08LKTazvBNIYU X-Received: by 10.66.73.166 with SMTP id m6mr17343582pav.122.1468619076311; Fri, 15 Jul 2016 14:44:36 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id s23sm5036316pfd.23.2016.07.15.14.44.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Jul 2016 14:44:35 -0700 (PDT) From: Kees Cook To: linux-kernel@vger.kernel.org Subject: [PATCH v3 09/11] s390/uaccess: Enable hardened usercopy Date: Fri, 15 Jul 2016 14:44:23 -0700 Message-Id: <1468619065-3222-10-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1468619065-3222-1-git-send-email-keescook@chromium.org> References: <1468619065-3222-1-git-send-email-keescook@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160715_144455_293443_1B3B2842 X-CRM114-Status: GOOD ( 10.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jan Kara , kernel-hardening@lists.openwall.com, Benjamin Herrenschmidt , Balbir Singh , Will Deacon , linux-mm@kvack.org, sparclinux@vger.kernel.org, linux-ia64@vger.kernel.org, Christoph Lameter , Andrea Arcangeli , linux-arch@vger.kernel.org, Michael Ellerman , x86@kernel.org, Russell King , linux-arm-kernel@lists.infradead.org, Catalin Marinas , PaX Team , Borislav Petkov , Mathias Krause , Fenghua Yu , Rik van Riel , Kees Cook , Vitaly Wool , David Rientjes , Tony Luck , Andy Lutomirski , Josh Poimboeuf , Andrew Morton , Dmitry Vyukov , Laura Abbott , Brad Spengler , Ard Biesheuvel , Pekka Enberg , Daniel Micay , Casey Schaufler , Joonsoo Kim , linuxppc-dev@lists.ozlabs.org, "David S. Miller" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Enables CONFIG_HARDENED_USERCOPY checks on s390. Signed-off-by: Kees Cook --- arch/s390/Kconfig | 1 + arch/s390/lib/uaccess.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index a8c259059adf..9f694311c9ed 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -122,6 +122,7 @@ config S390 select HAVE_ALIGNED_STRUCT_PAGE if SLUB select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_EARLY_PFN_TO_NID + select HAVE_ARCH_HARDENED_USERCOPY select HAVE_ARCH_JUMP_LABEL select CPU_NO_EFFICIENT_FFS if !HAVE_MARCH_Z9_109_FEATURES select HAVE_ARCH_SECCOMP_FILTER diff --git a/arch/s390/lib/uaccess.c b/arch/s390/lib/uaccess.c index ae4de559e3a0..6986c20166f0 100644 --- a/arch/s390/lib/uaccess.c +++ b/arch/s390/lib/uaccess.c @@ -104,6 +104,7 @@ static inline unsigned long copy_from_user_mvcp(void *x, const void __user *ptr, unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) { + check_object_size(to, n, false); if (static_branch_likely(&have_mvcos)) return copy_from_user_mvcos(to, from, n); return copy_from_user_mvcp(to, from, n); @@ -177,6 +178,7 @@ static inline unsigned long copy_to_user_mvcs(void __user *ptr, const void *x, unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) { + check_object_size(from, n, true); if (static_branch_likely(&have_mvcos)) return copy_to_user_mvcos(to, from, n); return copy_to_user_mvcs(to, from, n);