From patchwork Thu Apr 6 04:00:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9666017 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 3B401602B3 for ; Thu, 6 Apr 2017 04:01:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2873F28138 for ; Thu, 6 Apr 2017 04:01:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A60528304; Thu, 6 Apr 2017 04:01:17 +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 BE8D628138 for ; Thu, 6 Apr 2017 04:01:16 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=bvOAi2dJ2T4kiIYkL2JjVxIXDqcN0c6uh3eD0SxssCM=; b=g9/MVvoh6Er67L t4L1l1l6dti5v2wQLYPdIR6H/rJZ+QNlGf0prlaMTaTYe2CdmoBhOMQxqXYjnFSgfQFjAdGYkGYOV TlwpaVbUyXwB4vCsTzzwI4dy5Uc8NvEXaUAcqt0QfG0iGIWAloPLpy+wcYlMbFHGbOW6TSzDhQagx +Fxc+1+kwI7N5lMHg4Il/ZHp4z5TpnAjdz/wbOtde/JuPAhT0YgK27nifcYnQ1vIM9W+cG5KZ1Fdl c8LAbK3q44XZVgs9ioNWO6gM3MvPXE/gR7Rkt7T0kJug7VbZc55s2X3WK4groM91YyrEKBk3on3RG sengk/hwi1gYYewg8Uvw==; 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 1cvybi-0006yW-Rm; Thu, 06 Apr 2017 04:01:14 +0000 Received: from mail-pg0-x22b.google.com ([2607:f8b0:400e:c05::22b]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cvybf-0006x4-7U for linux-arm-kernel@lists.infradead.org; Thu, 06 Apr 2017 04:01:13 +0000 Received: by mail-pg0-x22b.google.com with SMTP id x125so23510175pgb.0 for ; Wed, 05 Apr 2017 21:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=og6QroqyArTWESukr6oXSR23wfq1lRcCavDaQeybzbI=; b=iS6crOAiwCg/HRsz0Eyi/Ah2EQTD4ogcXq4xfCfO9tC4ug3YljAsLJTHoNohnyxXkJ eT2WGx2NGMULhS/m/mzsvDOvj/34+evuEQ80/0VvIjfj134uA8OyEFlpmbxezXLMPPoe qRqYX+JJPre0Hq3Xb33/HfWFQf47Jh8k8QHJI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=og6QroqyArTWESukr6oXSR23wfq1lRcCavDaQeybzbI=; b=YZRZ3l7yjaMdv6M0bwUd+Xp5JmX5mgl+e/3CusqITV8hQJwhQ0onkOvUv607Z6eqey DuhCsq+w2bFP78+OyuRpa9i9m/T2o6tkRYu+yv88tqot12YBpabk8I4/kZkwwKZur6XS J+zrm04HnB6pLkjEx+amGD5Mxy/te++VpZVub3B0+W07HQfpSXQALNBSeaI2FdbcLt3d snm/daP3Po/jNE/orIeF2jP9lmaFt5luVRLCiRHFlJPCtm2VUeiRAICzshrB4trvfxKe vEAiovGFx/ETc5uDXqQpZeLq3RkdocrRjm80Qq8o1rTH6/ETXlNWDhc+cjgzBzNkTkGG IiKQ== X-Gm-Message-State: AFeK/H2dqPMBxq0DkGZDyVhQK/F0MA8RN6yMo9Qst98o3+yKgjD9I7saCGLkOteoiLalH5eX X-Received: by 10.99.232.21 with SMTP id s21mr34345374pgh.67.1491451249958; Wed, 05 Apr 2017 21:00:49 -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 t70sm472091pgd.33.2017.04.05.21.00.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Apr 2017 21:00:49 -0700 (PDT) Date: Wed, 5 Apr 2017 21:00:48 -0700 From: Kees Cook To: linux-kernel@vger.kernel.org Subject: [PATCH] ARM: domains: Extract common USER domain init Message-ID: <20170406040048.GA96187@beast> MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170405_210111_317615_0092993D X-CRM114-Status: GOOD ( 11.68 ) 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: Vladimir Murzin , Russell King , linux-arm-kernel@lists.infradead.org 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) | \