From patchwork Tue Jan 3 17:21:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9495269 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 9AEAA606A7 for ; Tue, 3 Jan 2017 17:26:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A224427BFF for ; Tue, 3 Jan 2017 17:26:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9546127C2D; Tue, 3 Jan 2017 17:26:04 +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=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 149F427BFF for ; Tue, 3 Jan 2017 17:26:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cOSpG-0005Jl-RE; Tue, 03 Jan 2017 17:24:42 +0000 Received: from mail-qk0-f177.google.com ([209.85.220.177]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cOSnW-0004Im-1l for linux-arm-kernel@lists.infradead.org; Tue, 03 Jan 2017 17:22:55 +0000 Received: by mail-qk0-f177.google.com with SMTP id t184so381978654qkd.0 for ; Tue, 03 Jan 2017 09:22:33 -0800 (PST) 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=GEOXq8ULiI4Ppc5Mt2KWyjDiJQZkuOQPLt2ACmofwg0=; b=jxVq0HpXagS5Sda76ztF6E5ivvpNH4tXct22RDTSP26xtrwLKxSrC68o9ZfGBzUnjN j2gP8emL0DLraQFz2HkqtonP6IAtwqoby2XrGReGFIhJeCSfzPmj0Nj/hW3nXyqt3VEE lg2eprjdfsWN3zEp5IZ6+8iYp4NALYhxWRMkpmLKUxG8pXEF3u+UMsB7W1/SV4o9vggo lZDDiBAXM+Hqbv15ObckZTvn2E8ws/6xFc2TcvPDON/BYrx8U8XGBn4fpeb41r5zQ/E2 QpmBU/vcDNop1XaWcbo5ZpnhdVxxO5+i2aaouKkWuF3TcQiBNpJG4BE8hqRK0keWtAoV mMwQ== X-Gm-Message-State: AIkVDXLaS5VDtSocv5C/S5DUzB/MyaD7zZoEFnJ9BPDbEExqbSh9wSy1RzEyllpFTHMse1N2 X-Received: by 10.55.80.198 with SMTP id e189mr60723043qkb.222.1483464152880; Tue, 03 Jan 2017 09:22:32 -0800 (PST) Received: from labbott-redhat-machine.redhat.com ([2601:602:9802:a8dc::6b06]) by smtp.gmail.com with ESMTPSA id 53sm44034313qtm.5.2017.01.03.09.22.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jan 2017 09:22:31 -0800 (PST) From: Laura Abbott To: Mark Rutland , Ard Biesheuvel , Will Deacon , Catalin Marinas , Andrey Ryabinin Subject: [PATCHv6 09/11] mm/kasan: Switch to using __pa_symbol and lm_alias Date: Tue, 3 Jan 2017 09:21:51 -0800 Message-Id: <1483464113-1587-10-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483464113-1587-1-git-send-email-labbott@redhat.com> References: <1483464113-1587-1-git-send-email-labbott@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170103_092254_276256_9829E883 X-CRM114-Status: GOOD ( 12.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, Ingo Molnar , Alexander Potapenko , Dmitry Vyukov , "H. Peter Anvin" , Joonsoo Kim , Thomas Gleixner , Laura Abbott , Andrew Morton , linux-arm-kernel@lists.infradead.org, Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP __pa_symbol is the correct API to find the physical address of symbols. Switch to it to allow for debugging APIs to work correctly. Other functions such as p*d_populate may call __pa internally. Ensure that the address passed is in the linear region by calling lm_alias. Reviewed-by: Mark Rutland Tested-by: Mark Rutland Signed-off-by: Laura Abbott --- mm/kasan/kasan_init.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/mm/kasan/kasan_init.c b/mm/kasan/kasan_init.c index 3f9a41c..31238da 100644 --- a/mm/kasan/kasan_init.c +++ b/mm/kasan/kasan_init.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -49,7 +50,7 @@ static void __init zero_pte_populate(pmd_t *pmd, unsigned long addr, pte_t *pte = pte_offset_kernel(pmd, addr); pte_t zero_pte; - zero_pte = pfn_pte(PFN_DOWN(__pa(kasan_zero_page)), PAGE_KERNEL); + zero_pte = pfn_pte(PFN_DOWN(__pa_symbol(kasan_zero_page)), PAGE_KERNEL); zero_pte = pte_wrprotect(zero_pte); while (addr + PAGE_SIZE <= end) { @@ -69,7 +70,7 @@ static void __init zero_pmd_populate(pud_t *pud, unsigned long addr, next = pmd_addr_end(addr, end); if (IS_ALIGNED(addr, PMD_SIZE) && end - addr >= PMD_SIZE) { - pmd_populate_kernel(&init_mm, pmd, kasan_zero_pte); + pmd_populate_kernel(&init_mm, pmd, lm_alias(kasan_zero_pte)); continue; } @@ -92,9 +93,9 @@ static void __init zero_pud_populate(pgd_t *pgd, unsigned long addr, if (IS_ALIGNED(addr, PUD_SIZE) && end - addr >= PUD_SIZE) { pmd_t *pmd; - pud_populate(&init_mm, pud, kasan_zero_pmd); + pud_populate(&init_mm, pud, lm_alias(kasan_zero_pmd)); pmd = pmd_offset(pud, addr); - pmd_populate_kernel(&init_mm, pmd, kasan_zero_pte); + pmd_populate_kernel(&init_mm, pmd, lm_alias(kasan_zero_pte)); continue; } @@ -135,11 +136,11 @@ void __init kasan_populate_zero_shadow(const void *shadow_start, * puds,pmds, so pgd_populate(), pud_populate() * is noops. */ - pgd_populate(&init_mm, pgd, kasan_zero_pud); + pgd_populate(&init_mm, pgd, lm_alias(kasan_zero_pud)); pud = pud_offset(pgd, addr); - pud_populate(&init_mm, pud, kasan_zero_pmd); + pud_populate(&init_mm, pud, lm_alias(kasan_zero_pmd)); pmd = pmd_offset(pud, addr); - pmd_populate_kernel(&init_mm, pmd, kasan_zero_pte); + pmd_populate_kernel(&init_mm, pmd, lm_alias(kasan_zero_pte)); continue; }