From patchwork Tue Jan 9 20:56:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10153309 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 06FAF602CA for ; Tue, 9 Jan 2018 20:57:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0D7424B48 for ; Tue, 9 Jan 2018 20:57:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E50A1251F4; Tue, 9 Jan 2018 20:57:43 +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 454AD24B48 for ; Tue, 9 Jan 2018 20:57:43 +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=jn9HSbbP5QoLeYGuvngxHw4ziN zC1/NT7HNqg738Co1MnuaL49KQcb8cTdWxqOzIwmSti7h0iLQvNngsq6sRv5L+LMn/cntUInaf0Ya 8oZ4eEfLOfwiX6a/qffu0EiCJH6obaX2L6YaX61ndI1DE3j8HiTvVYO+GbEDnaNx7vGPGYYZkWr1n zwmmUqsvLbrHFWuQ3MFh9S280UCWkgMoaKmlnqLPB5WVNGrL8h4x42pE7aTIMbH9PPyatf25th51T D4PMqtH0oxLCS+4CtD17P3hJJ2OnN5RnxGWjHbFc+nluw6lxG0GMlCzKGBnEBXdoUHqjhGHbVqzG6 /ajRPIpA==; 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 1eZ0xo-00036h-0D; Tue, 09 Jan 2018 20:57:40 +0000 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eZ0xW-0002gw-Ho for linux-arm-kernel@lists.infradead.org; Tue, 09 Jan 2018 20:57:25 +0000 Received: by mail-pg0-x244.google.com with SMTP id q67so8812332pga.9 for ; Tue, 09 Jan 2018 12:57:12 -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=jCVS7jRe2clrlUAc2IhrKGbR4cPGDaE78uuNYPdPly8XQ2vrre5lA2yU25dKXKs9kC rmIgB+AHzlBMeUZQOoTrCe1BnPK4xMG9TsJEpvZ5q13JMdbQ6+bqaMnWqG3+AuuXO4Ku hAWTFLEJNH6tbjMMNj/8/irnNpkzqD3eQVaCk= 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=VEZ+US1M2JwI1cy5LOpD34xjnLnOImr22ezLWPyUdbx6ncYIlwher+Ey4oQGtnzhj0 CHgmtdhZ4jKO89CRzdxMaCAna8OPrbkiJ4tgh8Y/svxPaCabvasIdVkMsPF6rvsq8iUV tHXGBclbdzT0kGgsqOZTq2IglkkySAJPlkYGLwoUwCSzzEO30DgwnZLh/JSGRDKPEGyF WUhwIm9F7T9ap2aINr3mvd3b3inw2Zt8Hqtcs/53xPfqpKCOcle9uSZGlAJS+XRi4tE5 Bks6XSyrXz8hx1p9zb5tH1GzWFdunLKjF4RCdjnEc5kxoq6bKVFVksyXTFn2b+QohfrR IzXg== X-Gm-Message-State: AKGB3mL0zQuAaZRbGiR0MRItbIh4qJzYtIrVnrGr9rufAhpq+eH4LQfr M/ZiQkMbawwd3KkAaL1PPRPUkQ== X-Google-Smtp-Source: ACJfBou3q519eSq6yafSzRyxuGQNeKG3Ws6Ller99Iky5hMHUBQsWzby5g4n0pei4tvb1ypm2UIaqA== X-Received: by 10.101.80.74 with SMTP id k10mr13538098pgo.246.1515531432027; Tue, 09 Jan 2018 12:57:12 -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 p72sm34613396pfa.84.2018.01.09.12.57.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 12:57:10 -0800 (PST) From: Kees Cook To: linux-kernel@vger.kernel.org Subject: [PATCH 31/36] arm: Implement thread_struct whitelist for hardened usercopy Date: Tue, 9 Jan 2018 12:56:00 -0800 Message-Id: <1515531365-37423-32-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180109_125722_594039_8599DDBC X-CRM114-Status: GOOD ( 11.82 ) 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) \