From patchwork Thu Mar 9 20:52:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9614177 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 773D960414 for ; Thu, 9 Mar 2017 20:55:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C6E928334 for ; Thu, 9 Mar 2017 20:55:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60F8F28672; Thu, 9 Mar 2017 20:55:28 +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 8FD8D28334 for ; Thu, 9 Mar 2017 20:55:27 +0000 (UTC) Received: (qmail 1368 invoked by uid 550); 9 Mar 2017 20:55:25 -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 28472 invoked from network); 9 Mar 2017 20:53:38 -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=YP1SfWg5gnTBAa6uTUAePt4V4ntotS+kcP+W6yxvIgQ=; b=WKJzX+X6hsZO5gENcK4vRzsRu/LQ0ai27Zt0OMfJiIhKnCFfJuVB9Q0xB+3gtRliQ3 RcRji5U9P+qxFFzTWYSbpIHHV0I+PYdIzeFc2WXBxYOYSLoQWCUGErfBh6l/ZcI0XYCu N5+WE8+b7s+mTmKns9O0cNBtreiUg64gHF9w4= 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=YP1SfWg5gnTBAa6uTUAePt4V4ntotS+kcP+W6yxvIgQ=; b=iVoQT/EhGHplGWPKtUdHcOlO2Kps73rl1bTg9reCJuV//jX1+kvjedDXDfQ7j2sn4A +x2htJUsqswxaT8/wOg+C7EDVlv15DE+kDINM1aV4uuWYif4XpkKpbDpBXI3greGjWNG GV9HfMjdgHwDqwdoEmwYZljPb7KX3BbRs01PsIuj6/ydBASYDZ9fVW3fnoYmBptwElmf cnMbK9xQKvGCRgEf81c1ruwIZx8tn9VIjimb56nmpfHeO0PsVOJkiLR0jCTgymPQsiep pWXu9aC3XUcPHf3NMr886lxU1Jo12XjvNvdJVj/07fxwijP5Wn8BJbhFftDD6Coyxu4V 0blw== X-Gm-Message-State: AMke39noR4w2ImyGP5i8EG0hj/Y6PZiGcwTx7JcC43eXGRLXUR886oHJzHW11rXH6PiRlRYd X-Received: by 10.28.186.70 with SMTP id k67mr11660355wmf.65.1489092807568; Thu, 09 Mar 2017 12:53:27 -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:04 +0100 Message-Id: <1489092729-16871-7-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 06/11] arm64/mmu: align alloc_init_pte prototype with pmd/pud versions X-Virus-Scanned: ClamAV using ClamSMTP Align the function prototype of alloc_init_pte() with its pmd and pud counterparts by replacing the pfn parameter with the equivalent physical address. Reviewed-by: Mark Rutland Signed-off-by: Ard Biesheuvel --- arch/arm64/mm/mmu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 75e21c33caff..bb9179084217 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -107,7 +107,7 @@ static bool pgattr_change_is_safe(u64 old, u64 new) } static void alloc_init_pte(pmd_t *pmd, unsigned long addr, - unsigned long end, unsigned long pfn, + unsigned long end, phys_addr_t phys, pgprot_t prot, phys_addr_t (*pgtable_alloc)(void)) { @@ -128,8 +128,7 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr, do { pte_t old_pte = *pte; - set_pte(pte, pfn_pte(pfn, prot)); - pfn++; + set_pte(pte, pfn_pte(__phys_to_pfn(phys), prot)); /* * After the PTE entry has been populated once, we @@ -137,6 +136,7 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr, */ BUG_ON(!pgattr_change_is_safe(pte_val(old_pte), pte_val(*pte))); + phys += PAGE_SIZE; } while (pte++, addr += PAGE_SIZE, addr != end); pte_clear_fixmap(); @@ -182,7 +182,7 @@ static void alloc_init_pmd(pud_t *pud, unsigned long addr, unsigned long end, BUG_ON(!pgattr_change_is_safe(pmd_val(old_pmd), pmd_val(*pmd))); } else { - alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys), + alloc_init_pte(pmd, addr, next, phys, prot, pgtable_alloc); BUG_ON(pmd_val(old_pmd) != 0 &&