From patchwork Wed May 30 09:12:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Yao X-Patchwork-Id: 10437991 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 18937601D3 for ; Wed, 30 May 2018 09:14:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09CB02872E for ; Wed, 30 May 2018 09:14:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F20E4288E8; Wed, 30 May 2018 09:14:02 +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=-5.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 17FFD2872E for ; Wed, 30 May 2018 09:14:01 +0000 (UTC) Received: (qmail 17837 invoked by uid 550); 30 May 2018 09:13:37 -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 17608 invoked from network); 30 May 2018 09:13:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wQhLdA74ZiItthHGzbiB0wMUGLrpfRV9zikrFpAUK5w=; b=SGEdvnvKHAq55hrBwg27ZGsn0qROfdsZJlYUkhBEsP8ZhU32Esrkbkj725lKp0ntEw bLr4lak8wlxzgj4rEJH1Z/7O7DLaq6wjzZYAfyDlicbATb0y9InZRKQJ5WN1G0cHBWAC kA8yLjaz2RUw1iUpTWTNzBok3SzqZLep2eWBbyr8nGbbAZcLm7fBQjETwwcuQlzXiPfH XAJJmyMq1YsD4BkqoW1NxWld2jh9PHxECP0a2Jm6kwwacn/vlBnCFJqQn5Ovz+cC8zl6 ZNkU+nPr4vthXrgYqV2WWZmF3nJi2VpgZxioGOFJhn9ABuTeCcW3mCYsrfazwZkO5U+3 duzA== 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=wQhLdA74ZiItthHGzbiB0wMUGLrpfRV9zikrFpAUK5w=; b=M6gw+Jx4Dq9/rlKEbe8gnsvTTpE2EBTW3DE9IC+beMP0DIyDJuRRLO8uKNqNxv+c9R Aev0s43Tn/EXGHjvi1YQ90AEJdK9mcgedA/WFZOPLIyAyBVN/oLAKtgwD3ZUxo6zh+ed Siyvv1zEe9L3q3Rnmey5TLqlmS9+/aXtVJE3cfYDo2rwxeQnLrQmBa5e7m+g9HIbeNk/ VPv+IsNLfrYxI8K2g08j13aSZzJixJh4BwXFt2C2TujAvbyLez5hLmmyJW/Wds6JD5Hc yblOEofX6Az0YvTaB2UfL6D4iuqaCUtEmIKxYMfy+QwiqYMfXW3twFY9JYJs/VVDsoDg dOqw== X-Gm-Message-State: ALKqPwdw6Zk8NRD3ldS26ZhbC+3O4YLfrg5V56+i8LQyMOzhtBgRjJuw 1T4MW6xRc3Eh80FNTiq0ARS7a/ls X-Google-Smtp-Source: ADUXVKJljISaGv8L6q2/txAmgRiVDNfR/PRoMYtgbqHSqJAJ9ISR0vYFriJrU5mtyN6kryTHi7zXaw== X-Received: by 2002:a63:6e02:: with SMTP id j2-v6mr1603010pgc.423.1527671601582; Wed, 30 May 2018 02:13:21 -0700 (PDT) From: YaoJun To: kernel-hardening@lists.openwall.com Cc: catalin.marinas@arm.com, will.deacon@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mark.rutland@arm.com Subject: [PATCH 3/4] arm64/mm: migrate swapper_pg_dir Date: Wed, 30 May 2018 17:12:58 +0800 Message-Id: <20180530091259.9386-4-yaojun8558363@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180530091259.9386-1-yaojun8558363@gmail.com> References: <20180530091259.9386-1-yaojun8558363@gmail.com> X-Virus-Scanned: ClamAV using ClamSMTP Make tramp_pg_dir and swapper_pg_dir adjacent. So we can migrate them together. Signed-off-by: YaoJun --- arch/arm64/kernel/entry.S | 4 ++-- arch/arm64/kernel/vmlinux.lds.S | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index ec2ee720e33e..b35425feaf56 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -1004,7 +1004,7 @@ __ni_sys_trace: .macro tramp_map_kernel, tmp mrs \tmp, ttbr1_el1 - add \tmp, \tmp, #(PAGE_SIZE + RESERVED_TTBR0_SIZE) + add \tmp, \tmp, #(PAGE_SIZE) bic \tmp, \tmp, #USER_ASID_FLAG msr ttbr1_el1, \tmp #ifdef CONFIG_QCOM_FALKOR_ERRATUM_1003 @@ -1023,7 +1023,7 @@ alternative_else_nop_endif .macro tramp_unmap_kernel, tmp mrs \tmp, ttbr1_el1 - sub \tmp, \tmp, #(PAGE_SIZE + RESERVED_TTBR0_SIZE) + sub \tmp, \tmp, #(PAGE_SIZE) orr \tmp, \tmp, #USER_ASID_FLAG msr ttbr1_el1, \tmp /* diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index 0221aca6493d..a094156e05a4 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -219,15 +219,15 @@ SECTIONS idmap_pg_dir = .; . += IDMAP_DIR_SIZE; -#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 - tramp_pg_dir = .; - . += PAGE_SIZE; -#endif - #ifdef CONFIG_ARM64_SW_TTBR0_PAN reserved_ttbr0 = .; . += RESERVED_TTBR0_SIZE; #endif + +#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 + tramp_pg_dir = .; + . += PAGE_SIZE; +#endif swapper_pg_dir = .; . += SWAPPER_DIR_SIZE; swapper_pg_end = .;