Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752090AbdITUwv (ORCPT ); Wed, 20 Sep 2017 16:52:51 -0400 Received: from mail-pf0-f174.google.com ([209.85.192.174]:54301 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751946AbdITUws (ORCPT ); Wed, 20 Sep 2017 16:52:48 -0400 X-Google-Smtp-Source: AOwi7QB/HEyBIJSiSs2cFJxXLELjSpOxcBXaP2aEHVK2B2TTBd+YM3iOeKcwz8uMGg8jQLHF7Fp4MA== 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, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org, kernel-hardening@lists.openwall.com, David Windsor Subject: [PATCH v3 28/31] arm64: Implement thread_struct whitelist for hardened usercopy Date: Wed, 20 Sep 2017 13:45:34 -0700 Message-Id: <1505940337-79069-29-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> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1762 Lines: 51 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 0df64a6a56d4..e190f9901aef 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -73,6 +73,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 29adab8138c3..759c4d90ac7f 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -90,6 +90,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) \ ({ \ -- 2.7.4