From patchwork Sun Sep 3 12:07:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9936177 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 77DDB603D7 for ; Sun, 3 Sep 2017 12:13:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A1BE286A9 for ; Sun, 3 Sep 2017 12:13:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5EFE4286B3; Sun, 3 Sep 2017 12:13:42 +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 21443286A9 for ; Sun, 3 Sep 2017 12:13:39 +0000 (UTC) Received: (qmail 18189 invoked by uid 550); 3 Sep 2017 12:09:42 -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 18077 invoked from network); 3 Sep 2017 12:09:40 -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=iXBNV6R4eOrAuETWJacDSUwVoyk132IthcQRQ6HiNh1ZA8Bsasnuef1B0Rpl4RoWRB Cr3faj6PHTT358GaU5iNT7vARtuL0PHscHI6MAgk8rccxprNmRreNQLpNlLfXrBz4qFK 8xC6WPCuCe6OwoXbs5vwrklfUf6o7uUue/XWw= 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=spptzbDzftyGv5l/bHGYJd1YoZS/uBq3rXBWA3tAhtD0QqSLRFiiQhcBy+ZBWcHinV 8g1rWtFYXboUS4/DyAVUXbz4Y2yWsPyluzgFndI0Hvtbmyc503Tt0xk08JR4KR/Gn6Dc SCi4LrFl1X/rHhaeNnGFkwM8cfPDiMNztleyyq90z1jRTJfjqEqBhTiAkNqjONmTJW1U 7WRwZB/lEYIiCQLa7vQxUhRv1hY7r7CEJI0us4C5XmTa7HkNzaNmLZoNZ8KbLZhYMROo ZOGZXDRSPGcDom7nPlgamSYFLM5E9WQ7JRqP2vSLeOrEaayna+6GGMpABAeZIPs/s20T EhXw== X-Gm-Message-State: AHPjjUgbM43fqv6qN6a4FctlWWkFegv6kpv2QI7ewskDwrLO/YUw0oZD S9PfCqBHAQMsgLjA X-Google-Smtp-Source: ADKCNb43dCvH9d3XIEnFW+1nZpgm43JHWt3kLUSmKGvLz5FTGXk+2l88A+MI2n/PtyGWFvx88igwIA== X-Received: by 10.28.216.211 with SMTP id p202mr2468047wmg.100.1504440569524; Sun, 03 Sep 2017 05:09:29 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, kernel-hardening@lists.openwall.com Cc: Ard Biesheuvel , Arnd Bergmann , Nicolas Pitre , Russell King , Kees Cook , Thomas Garnier , Marc Zyngier , Mark Rutland , Tony Lindgren , Matt Fleming , Dave Martin Date: Sun, 3 Sep 2017 13:07:51 +0100 Message-Id: <20170903120757.14968-24-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170903120757.14968-1-ard.biesheuvel@linaro.org> References: <20170903120757.14968-1-ard.biesheuvel@linaro.org> Subject: [kernel-hardening] [PATCH v2 23/29] 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 Acked-by: Nicolas Pitre --- 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