From patchwork Mon Aug 14 12:54:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9898849 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 A2158602BA for ; Mon, 14 Aug 2017 12:58:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 969AB285E3 for ; Mon, 14 Aug 2017 12:58:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B2A8285FD; Mon, 14 Aug 2017 12:58:56 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 9262C285E3 for ; Mon, 14 Aug 2017 12:58:55 +0000 (UTC) Received: (qmail 27779 invoked by uid 550); 14 Aug 2017 12:55:56 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 26599 invoked from network); 14 Aug 2017 12:55:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Mrkp2nE++1pk1oWlOREgMVpsc36Ss9CHlS43eqiPoFg=; b=V7lmzDeQBqbL2AABKUVvWA0MBJ2lw5d5ZWxsjK1f/cCqKptjfDmdCUsdWPJzeMAwgg zcyGJaUAWXy5hgxBKxnN8kTVczzwRnXhrIBSWV57Yf59NhKd+kJyybUDvYkILIfJCQuD yqtloBD9s1+hbf1fzmjf7GaFFdCoXz2tF9f7E= 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=Mrkp2nE++1pk1oWlOREgMVpsc36Ss9CHlS43eqiPoFg=; b=OrDW7vq+QOf///lV2ieEn07wmK5MMWKLNvxEMCdZqrTYNS63JleXG9qlxLwyCwAK25 8ZqjMDm6f1Y1sJC88mw8O2mMLzjXB33gBVeQtek+ugA40rgIy8GR7u0Ktl4W9bgxgrP7 sN26bLcKji0bNR6M/0Fz2REN2oyc0TOHF2oBMJNX0aeH9CwvOuZhnmVgOiQOO0WCIN2q ZUvx+YX8/G9z77CBqPmBR7IesHaM9PpX1yuFd/KWo0/Kx1VOyb1R8QQ/HEmvgk9Rnh9j 2v0/l/y7RonKx6ZBXe0bQSYJuwBYFKWKA3vNdF4V3FylkvzsG4JlJYKWMYKtJIxVJMDG pfSQ== X-Gm-Message-State: AHYfb5j5qmuxHixbzNBeJ9d/7AyGBulGYaHCEdv569OgqffIlv/a8b82 YJx7rCffJJK6mf0CZHlz2A== X-Received: by 10.28.8.208 with SMTP id 199mr5517637wmi.118.1502715338699; Mon, 14 Aug 2017 05:55:38 -0700 (PDT) From: Ard Biesheuvel To: kernel-hardening@lists.openwall.com Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Arnd Bergmann , Nicolas Pitre , Russell King , Kees Cook , Thomas Garnier , Marc Zyngier , Mark Rutland , Tony Lindgren , Matt Fleming , Dave Martin Date: Mon, 14 Aug 2017 13:54:03 +0100 Message-Id: <20170814125411.22604-23-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814125411.22604-1-ard.biesheuvel@linaro.org> References: <20170814125411.22604-1-ard.biesheuvel@linaro.org> Subject: [kernel-hardening] [PATCH 22/30] ARM: kernel: refer to swapper_pg_dir via its symbol X-Virus-Scanned: ClamAV using ClamSMTP The location of swapper_pg_dir is relative to the kernel, not to PAGE_OFFSET or PHYS_OFFSET. So define the symbol relative to the start of the kernel image, and refer to it via its name. Cc: Russell King Signed-off-by: Ard Biesheuvel --- arch/arm/kernel/head.S | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 5d685e86148c..71bc0d037bc9 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S @@ -48,14 +48,6 @@ #define PMD_ORDER 2 #endif - .globl swapper_pg_dir - .equ swapper_pg_dir, KERNEL_RAM_VADDR - PG_DIR_SIZE - - .macro pgtbl, rd, phys - add \rd, \phys, #TEXT_OFFSET - sub \rd, \rd, #PG_DIR_SIZE - .endm - /* * Kernel startup entry point. * --------------------------- @@ -77,6 +69,9 @@ .arm __HEAD + .globl swapper_pg_dir + .equ swapper_pg_dir, . - PG_DIR_SIZE + ENTRY(stext) ARM_BE8(setend be ) @ ensure we are in BE8 mode @@ -172,7 +167,7 @@ ENDPROC(stext) * r4 = physical page table address */ __create_page_tables: - pgtbl r4, r8 @ page table address + adr_l r4, swapper_pg_dir @ page table address /* * Clear the swapper page table