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: 9962581 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 870DF60208 for ; Wed, 20 Sep 2017 20:59:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79EA525D9E for ; Wed, 20 Sep 2017 20:59:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E79229204; Wed, 20 Sep 2017 20:59: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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBCF225D9E for ; Wed, 20 Sep 2017 20:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752103AbdITUwz (ORCPT ); Wed, 20 Sep 2017 16:52:55 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:57022 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752084AbdITUwv (ORCPT ); Wed, 20 Sep 2017 16:52:51 -0400 Received: by mail-pf0-f178.google.com with SMTP id g65so2108768pfe.13 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=QTkuwwaswpKZ1m9bmcyy2LYm6EXJaF172Mh0uQUGE7xWoFm706G+DEQKyGKYYiFNar 9DT4rC9biNIqnbKpphwBn11tUdnFx/YtXnodlUnCvauE0rNAPV6jRQIET7Qjk0C1VLLV 5n5DRLtIapFKWg1l9/uhqn8onfDJNhM6SnfeZqqgcgWaGPUbD2m+vaviHzSSKXuqAp2N WOvp3k24SkXQdmuLKOZqdWNybjJsyKdmjF5V8RXqWXU8ZuJKkGXvfvneChnbolILTMXJ uWJesLaPIEZ/8pjlumlvSburgH8l5VyEDjInvFfPZZST99shG0bf40edx1O/skaI3teI QrUw== X-Gm-Message-State: AHPjjUj5k/CApg5/MxsQegFTfALFlPmjeRP257Pa3dZlRjV3Xzgvng2B rz9OYNVqzI12cEo+MgbpVaPMgg== 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 Cc: Kees Cook , Russell King , Ingo Molnar , Christian Borntraeger , "Peter Zijlstra (Intel)" , 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 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> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.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