From patchwork Tue Jan 9 20:55:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10153405 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 AFEE660223 for ; Tue, 9 Jan 2018 21:03:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A51A12018F for ; Tue, 9 Jan 2018 21:03:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99420204C4; Tue, 9 Jan 2018 21:03:15 +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 mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 9ADFC2018F for ; Tue, 9 Jan 2018 21:03:14 +0000 (UTC) Received: (qmail 9648 invoked by uid 550); 9 Jan 2018 20:57:35 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 9285 invoked from network); 9 Jan 2018 20:57:23 -0000 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=R68S45ZD6nXTAu+U1gPs/804W7IpHXuRTraDAv2wolo=; b=JtWFazFc5VjbyOeXDiDnb5TX4DHjcItSJuBrq4/1mvG1d+U4NVtbr1LmRD02gtsffL vfIG4ErwwRsItop3vNNjwy6kkZrpbB0Dom5iYesM27I7gaVAYDF5t0ZzD0L8nMWcIRZL Bry/+6cVdfLYlJfzZbdhKWjRN72za4Y/AulKM= 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=R68S45ZD6nXTAu+U1gPs/804W7IpHXuRTraDAv2wolo=; b=UpgzI1vPuzKmAA660RKHByu/gtPq1zq9nrtyYBNp7VtQqPdeywQGI5jep+7VgJDUWD CQ1dU7VWvMwn5Kh+nZ92ORwsf4FuHHoigYvaAzSk9Fdzpr0+8Lqtd5j+Ryln2bYbvzL3 6GzYq4jfaTc6dG5xalE+5lpX+LIGCwEVgTR4i12MSRqh6mf0dkBeH05ZQj/vKlrqqswT JN5rAQSkmKmIdsLhk/Ty+3a4P5Ndk4EwIEYHgc/uT95NKloomJTFvR59LG92ReVI51z3 ScxvasNTmagJ2T8Nj2SgqrHlH4T/8uLEg5ll6S+NQsJo49Hwm460ZlaQUbj6hV6U5O3n I9vw== X-Gm-Message-State: AKwxytfsCOPBy1s6pJiailJs7rRxG/XxwyU5mqIe3Zq3g2IoFFXSVHzQ TLCFe30SW/EzyjTyi9v6y6qpXQ== X-Google-Smtp-Source: ACJfBostUrlzca7of50Q2Oydt8wA0k/T1bsVtveR59xCxk90HCxm9BlA8k+ATSu/ZbIQ2tgs4HIAcA== X-Received: by 10.84.168.196 with SMTP id f62mr2982092plb.23.1515531431444; Tue, 09 Jan 2018 12:57:11 -0800 (PST) From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Kees Cook , Catalin Marinas , Will Deacon , Christian Borntraeger , Ingo Molnar , James Morse , "Peter Zijlstra (Intel)" , Dave Martin , zijun_hu , linux-arm-kernel@lists.infradead.org, Linus Torvalds , David Windsor , Alexander Viro , Andrew Morton , Andy Lutomirski , Christoph Hellwig , Christoph Lameter , "David S. Miller" , Laura Abbott , Mark Rutland , "Martin K. Petersen" , Paolo Bonzini , Christoffer Dall , Dave Kleikamp , Jan Kara , Luis de Bethencourt , Marc Zyngier , Rik van Riel , Matthew Garrett , linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org, kernel-hardening@lists.openwall.com Date: Tue, 9 Jan 2018 12:55:59 -0800 Message-Id: <1515531365-37423-31-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515531365-37423-1-git-send-email-keescook@chromium.org> References: <1515531365-37423-1-git-send-email-keescook@chromium.org> Subject: [kernel-hardening] [PATCH 30/36] arm64: Implement thread_struct whitelist for hardened usercopy X-Virus-Scanned: ClamAV using ClamSMTP This whitelists the FPU register state portion of the thread_struct for copying to userspace, instead of the default entire structure. Cc: Catalin Marinas Cc: Will Deacon Cc: Christian Borntraeger Cc: Ingo Molnar Cc: James Morse Cc: "Peter Zijlstra (Intel)" Cc: Dave Martin Cc: zijun_hu Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Kees Cook --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/processor.h | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a93339f5178f..c84477e6a884 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -90,6 +90,7 @@ config ARM64 select HAVE_ARCH_MMAP_RND_BITS select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT select HAVE_ARCH_SECCOMP_FILTER + select HAVE_ARCH_THREAD_STRUCT_WHITELIST select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRANSPARENT_HUGEPAGE select HAVE_ARCH_VMAP_STACK diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 023cacb946c3..e58a5864ec89 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -113,6 +113,14 @@ struct thread_struct { struct debug_info debug; /* debugging */ }; +/* Whitelist the fpsimd_state for copying to userspace. */ +static inline void arch_thread_struct_whitelist(unsigned long *offset, + unsigned long *size) +{ + *offset = offsetof(struct thread_struct, fpsimd_state); + *size = sizeof(struct fpsimd_state); +} + #ifdef CONFIG_COMPAT #define task_user_tls(t) \ ({ \