From patchwork Thu Mar 9 08:25: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: 9612663 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 23713602B4 for ; Thu, 9 Mar 2017 08:26:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0A08285A4 for ; Thu, 9 Mar 2017 08:26:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2F93285A7; Thu, 9 Mar 2017 08:26:21 +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 2C46C285A4 for ; Thu, 9 Mar 2017 08:26:20 +0000 (UTC) Received: (qmail 11843 invoked by uid 550); 9 Mar 2017 08:25:48 -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 11414 invoked from network); 9 Mar 2017 08:25:43 -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=l/KYGNgnYAQJILSLHgM6TDMe63UhhB73vAmw612NCfs=; b=KRm43grAg0hndyXPVb/v7KBdHAO2vywzDXF9EGQ4JTHneLphqCynPoVe/SUOWiSlmc 6J6yiHRg9l/XdAFkuTXW3H1NQCcN4gJbXfbZVoV6KuLgwepGeUqfjIiH+qVnEUDKjTxs BOh1OrS4noNJHiXfnCYrMTk0zJDCzM/jTTu48= 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=l/KYGNgnYAQJILSLHgM6TDMe63UhhB73vAmw612NCfs=; b=k435qXqOlPOW+4/QEKfLCdjd8/rAxcyD80NA8wjpa1P9qjxaaxNbHOQB2HyeDTyWNP A2EtAHLCZtUaodyMpvid839ke+g2/hcwL9XlYVWnMH3Wk6DSxmnblF1/wQ1KH/niMTmr EPjsehQv9TBonTucNU+iX8tmDrAFwKXhT6KUVZK0s8cc3IDINKZ+5300elRN+RUfpO0r O7zMaSA3I1kWFIVfsq2nB1MQgkLO3Rn7V6Fe1oQtdvm9mGqJZnq/5pDnv/3Ayqg6vKVN O6WIKlQigTZbH7dHweYp0bYeczebxIvSvoSbnTl3U3VWQtHhjhOJtz8RsNnvsZyJ6zRa dYVA== X-Gm-Message-State: AMke39mXWvCB7ooEVIxuhssdbHZ2CIsUyg1b63FE4zSA82HnHKqGFcfe2Oq8da3Yrb1S4JrP X-Received: by 10.28.1.209 with SMTP id 200mr10479809wmb.74.1489047931910; Thu, 09 Mar 2017 00:25:31 -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, kvmarm@lists.cs.columbia.edu, marc.zyngier@arm.com, Ard Biesheuvel Date: Thu, 9 Mar 2017 09:25:08 +0100 Message-Id: <1489047912-642-7-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489047912-642-1-git-send-email-ard.biesheuvel@linaro.org> References: <1489047912-642-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [kernel-hardening] [PATCH v5 06/10] 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. Signed-off-by: Ard Biesheuvel Reviewed-by: Mark Rutland --- 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..c3963c592ec3 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,8 @@ 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)); + phys += PAGE_SIZE; /* * After the PTE entry has been populated once, we @@ -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 &&