From patchwork Tue Nov 29 18:55:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9453029 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 706DE60710 for ; Tue, 29 Nov 2016 19:02:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DCBA27DCD for ; Tue, 29 Nov 2016 19:02:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51C7B283E6; Tue, 29 Nov 2016 19:02:07 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable 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 DB78027DCD for ; Tue, 29 Nov 2016 19:02:06 +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 1cBndj-0008Iv-RW; Tue, 29 Nov 2016 19:00:27 +0000 Received: from mail-qk0-f182.google.com ([209.85.220.182]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cBnZi-0004kq-Mt for linux-arm-kernel@lists.infradead.org; Tue, 29 Nov 2016 18:56:24 +0000 Received: by mail-qk0-f182.google.com with SMTP id q130so184717211qke.1 for ; Tue, 29 Nov 2016 10:56:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pm62DPgOhupsIPUYhUOiBKuqUMo1lrTX4JdFLQmKF6I=; b=KNCzXgDqfRa+ZR7blWP5ZFKYVMorRxKW+d5FIrQOFqaFv7+j5ChOy4NDqKZqjU2a88 pbGIVGpBsx2AD4p2fJClOgnhsHMTnZdg6O020t0s8SSamXIgpWEtweENe3bIuYnKVXxQ 59cq2W74smnSPYrngfAijqxHashcfy9kUNPVQ3bbj8l6bPtRlSmklCaWYmDtnOZrGxE4 pfWGUGtauOv30lrcPD4eyYa2spr4Cp+JCwaFmo6tYdLcxEpfpdjZ4BV5JntuEQBTfZ5L lkkIYEaXbG+fm+QKuNVw5THZC7V+ecipYnVK0xFcxKrRybOCBkenWAQ7y0GEaOJlPloL Oh2w== X-Gm-Message-State: AKaTC03NvDag6f2t38JizW7IlLcN4cc8aYtIw6J3SdUdRNbX1KZazHZfl4z3tzG6Zwa0FWsL X-Received: by 10.55.107.71 with SMTP id g68mr24090149qkc.259.1480445760547; Tue, 29 Nov 2016 10:56:00 -0800 (PST) Received: from labbott-redhat-machine.redhat.com ([2601:602:9800:177f::df9b]) by smtp.gmail.com with ESMTPSA id p28sm31446489qtb.31.2016.11.29.10.55.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Nov 2016 10:55:59 -0800 (PST) From: Laura Abbott To: Mark Rutland , Ard Biesheuvel , Will Deacon , Catalin Marinas , Andrey Ryabinin Subject: [PATCHv4 08/10] mm/kasan: Switch to using __pa_symbol and lm_alias Date: Tue, 29 Nov 2016 10:55:27 -0800 Message-Id: <1480445729-27130-9-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480445729-27130-1-git-send-email-labbott@redhat.com> References: <1480445729-27130-1-git-send-email-labbott@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161129_105619_087187_53A35E58 X-CRM114-Status: GOOD ( 12.34 ) 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. Signed-off-by: Laura Abbott Reviewed-by: Mark Rutland Tested-by: Mark Rutland --- Pointed out during review/testing of v3. --- mm/kasan/kasan_init.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/kasan/kasan_init.c b/mm/kasan/kasan_init.c index 3f9a41c..ff04721 100644 --- a/mm/kasan/kasan_init.c +++ b/mm/kasan/kasan_init.c @@ -49,7 +49,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 +69,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; } @@ -94,7 +94,7 @@ static void __init zero_pud_populate(pgd_t *pgd, unsigned long addr, pud_populate(&init_mm, pud, 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 +135,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; }