From patchwork Wed Mar 29 18:15:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9652223 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 37E98602C8 for ; Wed, 29 Mar 2017 18:18:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 215B428510 for ; Wed, 29 Mar 2017 18:18:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1602C2851A; Wed, 29 Mar 2017 18:18:16 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID 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 BCF4C28510 for ; Wed, 29 Mar 2017 18:18:15 +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=HwRrKrw186hIKqz5kgbig/eBZrfDoAa8MUeu1vsWADs=; b=TrywzQiEUYSxk2tG88SH2+xdPN p83mXmOQvAxx9xJ9voysZ0F2YMVcRrYuq0feBhcDKdVhRCHsf3PB+Foi1P5JFeW81fBOWMobAqKHv QDjcg94PXV+r+62ZJ9vinIJ+xKqGtVNGFl3lJscYBdQySNw6Ox0p5jPMIzEyhKyGCmv8KuCD8p23W VUTs9hVkYvYRVsbcs2WVflqzTaASx5iAKAh4JKWFNwqfjCjD5QfNxN9vdnOj0TkHdj+FXsx5MG5Ms lIFqrHIZF9qCeyd9Q5+XrcNqRlIkyZYDkzo9Q4fjSprld28XUMUb4XJ7oI0SsA1YJkzlubjTl0gq5 zMwJoPnQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ctIAb-0006fw-8M; Wed, 29 Mar 2017 18:18:09 +0000 Received: from mail-pg0-x22f.google.com ([2607:f8b0:400e:c05::22f]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ctI9E-00058K-PG for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2017 18:16:47 +0000 Received: by mail-pg0-x22f.google.com with SMTP id 81so14645522pgh.2 for ; Wed, 29 Mar 2017 11:16:24 -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=Qa2sg0NIH3kRUIPvy5YNgvIGEkfLTDAwHmEtXm2xrvw=; b=Gm9c2Aaa0m1BujeM0DrQZF6dS+hDvTuI+8Lj2WLq39+CDFDpBJeWVIwTzaElgq4dY3 Ee840M/iubp+RahR/MGho7j6GxQFeNUPil5LPQkR2aQmg3Zb4mXV3muenITFg9mACikZ E03f2d5PjpltxHUeKMijdnU00jUKwmqmBac/M= 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=Qa2sg0NIH3kRUIPvy5YNgvIGEkfLTDAwHmEtXm2xrvw=; b=c5jz1jffhCrBTVknaMMgG7xqbJhJv2QaFb4YexvDg6fl07f6148hVZaToc/PbnzURi Gs96TQoyqvp2lqZUclY5w8AozPOMOif7azi8C5o6fyULjWweVrGU4O2RqIQVCia4OFfx aEEBuVYDUyKrXxfjyw0SYmoo3P2tsovy57uqMv5cdPa1gKDbmJqFb8VPQt7uUHvBI13R MjlbXIiX+3qoYPpgIAtKX8QVIZsg6Rb7XFvtDRCbPDURKQmWsK1L1GmT+lCmuAGBGBVJ 615JnKHALBiUPeNaeXV+AIdR83rgUX/3UJyJy1UeCodM8OCu5OA8zPBnICcDRW7DkWDQ ZG/g== X-Gm-Message-State: AFeK/H1+9F3W+fVtOVe/LwW7kbwMRn5y3NkaM/MuHsydIoJ7SfjKzEqCbB3WqVLXjGKbpQ6D X-Received: by 10.84.228.194 with SMTP id y2mr2081146pli.85.1490811383847; Wed, 29 Mar 2017 11:16:23 -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 b10sm14819106pga.39.2017.03.29.11.16.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Mar 2017 11:16:22 -0700 (PDT) From: Kees Cook To: kernel-hardening@lists.openwall.com Subject: [RFC v2][PATCH 06/11] ARM: domains: Extract common USER domain init Date: Wed, 29 Mar 2017 11:15:58 -0700 Message-Id: <1490811363-93944-7-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490811363-93944-1-git-send-email-keescook@chromium.org> References: <1490811363-93944-1-git-send-email-keescook@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170329_111644_850049_573F8A8A X-CRM114-Status: GOOD ( 11.96 ) 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 , Hoeun Ryu , Kees Cook , x86@kernel.org, Russell King , linux-kernel@vger.kernel.org, Emese Revfy , Andy Lutomirski , PaX Team , linux-arm-kernel@lists.infradead.org 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 Everything but the USER domain is the same with CONFIG_CPU_SW_DOMAIN_PAN or not. This extracts the differences for a common DACR_INIT macro so it is easier to make future changes (like adding the WR_RARE domain). Signed-off-by: Kees Cook --- arch/arm/include/asm/domain.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h index 99d9f630d6b6..8b33bd7f6bf9 100644 --- a/arch/arm/include/asm/domain.h +++ b/arch/arm/include/asm/domain.h @@ -59,18 +59,18 @@ #define domain_val(dom,type) ((type) << (2 * (dom))) #ifdef CONFIG_CPU_SW_DOMAIN_PAN -#define DACR_INIT \ - (domain_val(DOMAIN_USER, DOMAIN_NOACCESS) | \ - domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ - domain_val(DOMAIN_IO, DOMAIN_CLIENT) | \ - domain_val(DOMAIN_VECTORS, DOMAIN_CLIENT)) +#define __DACR_INIT_USER \ + domain_val(DOMAIN_USER, DOMAIN_NOACCESS) #else +#define __DACR_INIT_USER \ + domain_val(DOMAIN_USER, DOMAIN_CLIENT) +#endif + #define DACR_INIT \ - (domain_val(DOMAIN_USER, DOMAIN_CLIENT) | \ + (__DACR_INIT_USER | \ domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ domain_val(DOMAIN_IO, DOMAIN_CLIENT) | \ domain_val(DOMAIN_VECTORS, DOMAIN_CLIENT)) -#endif #define __DACR_DEFAULT \ domain_val(DOMAIN_KERNEL, DOMAIN_CLIENT) | \