From patchwork Thu Mar 9 20:52:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9614187 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 178D260414 for ; Thu, 9 Mar 2017 20:56:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D35928429 for ; Thu, 9 Mar 2017 20:56:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02119286B2; Thu, 9 Mar 2017 20:56:11 +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 3DFE928429 for ; Thu, 9 Mar 2017 20:56:11 +0000 (UTC) Received: (qmail 3293 invoked by uid 550); 9 Mar 2017 20: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 29957 invoked from network); 9 Mar 2017 20:54:23 -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=vLGoaoHJBJ44doHM1p7vz7tigyQOWXzweraDQPWNOIs=; b=A4yviip3GQUItMNxGkRdJ9IrAAoj38e4ORaxGjlpqOU61Hs6MFpquCWOJNB805M+2H bONSK4VKHShSJp2AEBsrnyvzSGzEIKTNkkSVf8oXkii+wnqBqc7vDuxV3b9v8tjo6pOJ VmSadV5gHGbjqm6eQ8ofI9MpI7D7Y0vh62rNc= 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=vLGoaoHJBJ44doHM1p7vz7tigyQOWXzweraDQPWNOIs=; b=CbTeIH4JOyeDp/QnLmh4gH1Sm3cctmuQmZDE4zUgIQxRWNMfjk3eoNCkImFLh+zWPb GxGESmQWf7f43/ZQqg5i7JG7z7dpe5sfh8vlZsizpkJTlcnDhNGs6kgYmZtiMbxgm8qs ppGYfYmHnRxL4rzRfF8N1sEQMqqPnw+8QVczKkVzglAlPRxPlcISaZ8vi+lyMCOIMAAD bDO85hgwUNkT2e4A3hCz5HKWP5beip+nT/axsGjKZI54+sxeVKEtm9FMVBoI06CrBcJH a+vn7txAfwtrdKx+Yw8XshIh5zwSFiTUlcZfsTjXtIk1APj3vAboD8r37J5BXbjS/566 kWJg== X-Gm-Message-State: AMke39mlxY3ZVGs5MbRjeQywIrl+Y/zsbbSmCr0tI77W+Bn1t8itgst9geb7g9IPEyg8/K8k X-Received: by 10.28.186.195 with SMTP id k186mr21186742wmf.1.1489092851911; Thu, 09 Mar 2017 12:54:11 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, keescook@chromium.org, labbott@fedoraproject.org Cc: kernel-hardening@lists.openwall.com, will.deacon@arm.com, catalin.marinas@arm.com, Ard Biesheuvel Date: Thu, 9 Mar 2017 21:52:08 +0100 Message-Id: <1489092729-16871-11-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489092729-16871-1-git-send-email-ard.biesheuvel@linaro.org> References: <1489092729-16871-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [kernel-hardening] [PATCH v6 10/11] arm64/mm: remove pointless map/unmap sequences when creating page tables X-Virus-Scanned: ClamAV using ClamSMTP The routines __pud_populate and __pmd_populate only create a table entry at their respective level which refers to the next level page by its physical address, so there is no reason to map this page and then unmap it immediately after. Signed-off-by: Ard Biesheuvel Reviewed-by: Mark Rutland --- arch/arm64/mm/mmu.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index bc9d5eb7bfa2..85ab82f5a0bc 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -128,9 +128,7 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr, phys_addr_t pte_phys; BUG_ON(!pgtable_alloc); pte_phys = pgtable_alloc(); - pte = pte_set_fixmap(pte_phys); __pmd_populate(pmd, pte_phys, PMD_TYPE_TABLE); - pte_clear_fixmap(); } BUG_ON(pmd_bad(*pmd)); @@ -168,9 +166,7 @@ static void alloc_init_pmd(pud_t *pud, unsigned long addr, unsigned long end, phys_addr_t pmd_phys; BUG_ON(!pgtable_alloc); pmd_phys = pgtable_alloc(); - pmd = pmd_set_fixmap(pmd_phys); __pud_populate(pud, pmd_phys, PUD_TYPE_TABLE); - pmd_clear_fixmap(); } BUG_ON(pud_bad(*pud));