From patchwork Wed Sep 20 20:45:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9962529 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 D1B3F60208 for ; Wed, 20 Sep 2017 20:54:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3AD52920C for ; Wed, 20 Sep 2017 20:54:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B887D29224; Wed, 20 Sep 2017 20:54:03 +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.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4BF0E2920C for ; Wed, 20 Sep 2017 20:54:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=WtRHwjCwfRihN4++5+Xya2aOfnTbI22X3QsobYhDILc=; b=IyYSQVrJgAGEwnzfk4dZZ8u6CA 8V8JwHtebhulVE5dSysx2Rz4xRXRCE1alRXMgzOMPhwuTwv8HNHORbEVvcqXPyYnUw6Um6vajQP80 IHEmI4qJhvjpYqLdBuBuNcC7Jjl/2sw94DlYE62kuvB4H+GHnGv4lRze17j1vV7l5sAACt4ZPrhbc Ky3FJd32ZOLVuH1KGP8Dg0npAOkbPWPPurspCAxC8qC7+3EG0Z+lcx1KputbRblBw/+0y+qzXzI4b pnwiSKK19Pg1L03w1D1OJApoHujbhyIYN9oN3cNEtQYOu+l5/4/KLeMyM5rpaAPhfDwHwCoRkYOsf aTVSiwfw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dum0L-00035n-5j; Wed, 20 Sep 2017 20:53:57 +0000 Received: from mail-pf0-x233.google.com ([2607:f8b0:400e:c00::233]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dulzc-0002J2-7H for linux-arm-kernel@lists.infradead.org; Wed, 20 Sep 2017 20:53:16 +0000 Received: by mail-pf0-x233.google.com with SMTP id p87so2112096pfj.9 for ; Wed, 20 Sep 2017 13:52:51 -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=r5x+vswUmh+buKd45B8ZY2A/QYlK3ymQmShGf2SFSEM=; b=CGh/MqFHHxl8ITsdcW+B822e7YQJWSmIDxf5R5JdPMxN2oHk++077gSb96hgCXS/+2 A/bKTjf+85TuhwGbJfAtozOJLXQ9o4d/S8QpDYQXXXkUsHA95mCXhH/5EEW49D4btv1O WJWHiWjPRyHXQrbjXcdNUuINj+EoauemlME8w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=r5x+vswUmh+buKd45B8ZY2A/QYlK3ymQmShGf2SFSEM=; b=YB0fVZfrsfR3sQeoy/tTjTDbtUVbZfXrmvBm9/3slUMtrPwxmz6poXYCGL0AtIScJS MCnT0rNgcaUy6RuDCALcCyPPC9yLQ+yngY7vjh0/KMc9yinZXpqCmdYtXNSv0vIfI5xy W0cgYh5SSHv2b8K64KtNOU/HsAJYGMV2GFdTrerH0aN6soBEMDXC3CL2KllT69r7nrq3 WcynBPnthbEzWblrfs1kqrFw+F2g4pdROwRQpiykQN9moUlcwJVA7skZKCsc9D1U/c17 /3bs0ogMm8pvbmNQvJkkabIaONYYPZ92CuUelKBPI+Ol+qAHfV7VGfmszzFYAaPT5N2n 060A== X-Gm-Message-State: AHPjjUj4zCa5F27JaCwNrfbyXj0rw0gOYPvhwesoWsQLEZ3TE1B69W4/ s05yHGKPrxKGJx493j3N6vVJ1w== X-Google-Smtp-Source: AOwi7QDgw/j68/+blyqszg/lM0jrH0GWjCpvykB3+Wapql/0TftucT95m7aWqxt5mstxpt9tn9YpRQ== X-Received: by 10.84.229.71 with SMTP id d7mr3217844pln.417.1505940771447; Wed, 20 Sep 2017 13:52:51 -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 j68sm9758488pfa.93.2017.09.20.13.52.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Sep 2017 13:52:46 -0700 (PDT) From: Kees Cook To: linux-kernel@vger.kernel.org Subject: [PATCH v3 29/31] arm: Implement thread_struct whitelist for hardened usercopy Date: Wed, 20 Sep 2017 13:45:35 -0700 Message-Id: <1505940337-79069-30-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505940337-79069-1-git-send-email-keescook@chromium.org> References: <1505940337-79069-1-git-send-email-keescook@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170920_135312_447304_DCA1AE29 X-CRM114-Status: GOOD ( 10.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Windsor , Kees Cook , linux-mm@kvack.org, "Peter Zijlstra \(Intel\)" , netdev@vger.kernel.org, kernel-hardening@lists.openwall.com, Russell King , Christian Borntraeger , linux-fsdevel@vger.kernel.org, Ingo Molnar , linux-arm-kernel@lists.infradead.org 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 ARM does not carry FPU state in the thread structure, so it can declare no usercopy whitelist at all. Cc: Russell King Cc: Ingo Molnar Cc: Christian Borntraeger Cc: "Peter Zijlstra (Intel)" Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Kees Cook --- arch/arm/Kconfig | 1 + arch/arm/include/asm/processor.h | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 7888c9803eb0..4f1ab6c6b8c0 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -48,6 +48,7 @@ config ARM select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU select HAVE_ARCH_MMAP_RND_BITS if MMU select HAVE_ARCH_SECCOMP_FILTER if (AEABI && !OABI_COMPAT) + select HAVE_ARCH_THREAD_STRUCT_WHITELIST select HAVE_ARCH_TRACEHOOK select HAVE_ARM_SMCCC if CPU_V7 select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32 diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h index c3d5fc124a05..d6dc45c92ee5 100644 --- a/arch/arm/include/asm/processor.h +++ b/arch/arm/include/asm/processor.h @@ -45,6 +45,13 @@ struct thread_struct { struct debug_info debug; }; +/* Nothing needs to be usercopy-whitelisted from thread_struct. */ +static inline void arch_thread_struct_whitelist(unsigned long *offset, + unsigned long *size) +{ + *offset = *size = 0; +} + #define INIT_THREAD { } #ifdef CONFIG_MMU