From patchwork Thu Jan 11 02:03:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10156455 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 86F55605BA for ; Thu, 11 Jan 2018 02:03:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 751572856D for ; Thu, 11 Jan 2018 02:03:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68F73286D4; Thu, 11 Jan 2018 02:03:53 +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 C62772856D for ; Thu, 11 Jan 2018 02:03:52 +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=OWPa9HviqlrKwVAdKcr26EdEwTLtwarZLfLLDUKCoBo=; b=BcTJUMBO7ECXcRnVTZulphqkBl kxBubYzXzGk7VR5yJnZV0Zd4/R96lnGd7s9KchKJeVj0CutPmWaznWQ3SezOsXSYfxSuWkDYE9XfQ NJwzfLxcSeNoVMNIs89dp5Tkv510kJJftrxpFoU1+LsMipy/A18QepngCazYc7JTTWJ/jS2Ltma04 Ur//QIX5nPhLy+YgbNhM8xMM2n3X/JVrwAJvoslLW6VIZP4m7Pb88UDbijZ+zLeKy/Kak4jCFwIBp HEFJI01nzmeXVhToKgFVsvd6MVkw/555wpE6OjREumfSfeHWw/Eon5qCsWyfE9XXUvnbbhuzaD3h/ V+YQKa+w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eZSDf-0006ew-G8; Thu, 11 Jan 2018 02:03:51 +0000 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eZSDb-0006cC-EC for linux-arm-kernel@lists.infradead.org; Thu, 11 Jan 2018 02:03:49 +0000 Received: by mail-pg0-x241.google.com with SMTP id m20so1581686pgc.11 for ; Wed, 10 Jan 2018 18:03:36 -0800 (PST) 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=7xfHfVUjFIj7TupED5lWUwNqXxqh/MUqfoqT4XIi7K4=; b=keW/NYMCdqwbmqVX37Iam/L3jaU5oUn9dANY+YkZJcm60BrTkLBFu4iM5EnQSxdsda /fEKVWG/ngse/QMVao0LJ2//hgx9CpaYdG8ykfrxPAmD+OXKAHsb0S9lcVk1CSN0VRIC bcrRpRF3qM8HtkwmLIftJAJvizYkdqurCi3Jw= 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=7xfHfVUjFIj7TupED5lWUwNqXxqh/MUqfoqT4XIi7K4=; b=ZuivKYJIUYKQnYfDCHHJZIf5FVykepd7l8yo4QQ1x1fDw4BhdJ4Jl46gyEY1xkVebm nM0lO3B95R/6TPNewQoG4MHkWGT06GXH/bf0d8Zhui6KZasLMDt2MwdQxt5k7Fdtora1 mlzx3euBPlYb2nq9ZepAQuRhL8OWP7YqrRMAiZsGcoIOjy5PBvHCd0mqGgKUdpd/7cm1 IXpgMXMvQMRFiYT2PxJlLNce3NEVxTqHU6eLNoZSic40dv1SpOwB97ZcxpUAEu7vEQUl sis/JbhJPn1XeUiMubfc8YdGyuX7IgWWuQv7MWdjx+jlxe2xJffOm0tVLI8FIdAMrFjP y+gQ== X-Gm-Message-State: AKGB3mIcguvGZvr6pA4LsqpPo0rgVB84iQ2VO37ox2wsZZ2xf51xe4O7 mLRMqp9ocyYiniu2Tnd6HSpBSg== X-Google-Smtp-Source: ACJfBot0B7YaBJrK0JZO8fg2sGHmV81RgRz7RooG0LavGA/ra2ttdmHioMsqUs5F1XS1bczyJKM3Jg== X-Received: by 10.98.16.132 with SMTP id 4mr11403014pfq.42.1515636216533; Wed, 10 Jan 2018 18:03:36 -0800 (PST) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id b1sm30869173pgq.17.2018.01.10.18.03.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2018 18:03:32 -0800 (PST) From: Kees Cook To: linux-kernel@vger.kernel.org Subject: [PATCH 34/38] arm: Implement thread_struct whitelist for hardened usercopy Date: Wed, 10 Jan 2018 18:03:06 -0800 Message-Id: <1515636190-24061-35-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515636190-24061-1-git-send-email-keescook@chromium.org> References: <1515636190-24061-1-git-send-email-keescook@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180110_180347_471489_44196776 X-CRM114-Status: GOOD ( 11.87 ) 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: Mark Rutland , Jan Kara , kernel-hardening@lists.openwall.com, "Peter Zijlstra \(Intel\)" , Rik van Riel , linux-mm@kvack.org, Christoph Lameter , Ingo Molnar , linux-arch@vger.kernel.org, Russell King , Christoph Hellwig , Christian Borntraeger , Laura Abbott , David Windsor , Kees Cook , Marc Zyngier , Dave Kleikamp , Alexander Viro , Andy Lutomirski , linux-arm-kernel@lists.infradead.org, Luis de Bethencourt , "Martin K. Petersen" , netdev@vger.kernel.org, Matthew Garrett , linux-fsdevel@vger.kernel.org, Paolo Bonzini , Andrew Morton , Linus Torvalds , "David S. Miller" , Christoffer Dall 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 51c8df561077..3ea00d65f35d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -50,6 +50,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 338cbe0a18ef..01a41be58d43 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 { } #define start_thread(regs,pc,sp) \