Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2893092pxj; Sun, 20 Jun 2021 04:19:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWhCCmUlFZyHAWC68olx/BORlEXXyWXK4yBZp+e1xQcCHXLoh/B/7U45Fhj/4gGycdEBIN X-Received: by 2002:a05:6402:10d7:: with SMTP id p23mr15551087edu.74.1624187998489; Sun, 20 Jun 2021 04:19:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624187998; cv=none; d=google.com; s=arc-20160816; b=dycBYSNdo1WoJL+n0qQH4gqLUnzjqZkyiyomYfzDYA4pgRCvCuPswAVzDiKCXkbnEv t53WercrbKFNoWZe69xZHAqB7+rpIgIygv3L1nJx0pFwM+JotVh7o8tJdxm2aFwg2uYM P2xU3HhDZCloLVcaJr0O7TFZsa8/lseUh/+8ZomLYQgnm/11BBWiNYXR3S5tE4r2T165 rTSy+UGLCEQMEYVP/jmz4RwE73FAJKnnizq4q8SdDrVmxlifZNmj5jYPk/Q1l7v7e4HD Fs4vll9OQUDdmrOiFOIZhGNYCumlULlyo0tiSgJ1S8lVfbYLWhMtyL+Ua4vWrchjuK8R X1UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=QziFBff9GiMT4Os8umf/EiLjglEeNn/Ybki8x4poeu0=; b=cJYyUSwBTdf4nXb8lLDZ5zWFMVqEUDG+46DN3ocT0XZlam0d3XJhP35AT+1dpYoG6F DFcIw9wsLo28l7x/EhEPRuKxJ+zyBg+G3/xCYT6n67jVg6WJm5GisnJlIKUFVn5XApUn Mo3gne+lvY6dKPV3JUwo0d8GCCgR/7XIHMs2k0xjoGKSz2WCb4C1mXRGJOEGtRF+Tp+g LlY0NqY3hG+lGVbOX6T0qH12kFTJnIBlTnt4xU8LUD5eJpf8guOoXdVkhZy9LpKTZ6+z BaKFNKqSP/3s19AaaUS0Az7nWQLlLTjFdmLVd1vE1K82fd9xSG6zNIQT14Kr0ou/FUZ6 QqIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PUPR7UCL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si3063333ejl.35.2021.06.20.04.19.36; Sun, 20 Jun 2021 04:19:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PUPR7UCL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229568AbhFTLUd (ORCPT + 99 others); Sun, 20 Jun 2021 07:20:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbhFTLUc (ORCPT ); Sun, 20 Jun 2021 07:20:32 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 338CBC061574 for ; Sun, 20 Jun 2021 04:18:19 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id hz1so1127978ejc.1 for ; Sun, 20 Jun 2021 04:18:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QziFBff9GiMT4Os8umf/EiLjglEeNn/Ybki8x4poeu0=; b=PUPR7UCLEc58GXQJRHHhcsalboiBUKhgIE37jx1X1YWBZACe0Brp+YmMs43CnCPuk0 us8/fLV6tuKG8vV0wrRUK3vn0vXtCMCHxecWzLCL1D4hN8dijyv/IHdQBvbpmZKUy47O R8kuM3qxft9OQVL9Dy3fs1+G1UrlmaLws7fcflaiVAY9pLiLsILpNtw/t7qpKmhYHg49 Ifmnzs+CNNZsUpJlD8v3fA8QEvt3towamggAmaQHQ3kpn5+jClmKsv+38uoXEloU00zh jSGl0ayd9jQFJVe9TPf0sAmzWf/gm2n7NiYPpUgFMnI/10QTa+ZBwKcYmXez/NCSG6z+ r6Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QziFBff9GiMT4Os8umf/EiLjglEeNn/Ybki8x4poeu0=; b=tyKJKAJAAwa8AeEcohdyOWeMnlbfK2ApfX9WucXn9cCspfQZwwm71fRhtSHOIFCjkh w4HERTHVthAPRe+lFaFQCzojkpZ3/76lyFoUJGIrR3UUomBYYjnCa6KIBSLcICWcRIi0 GOw/9ghePGMXrhOKn/GTUT859/3pH//z0RLdjsMj/JNILkrq59QguEl5vO/aIzZ+Z5Fb V26DGtUHJd0v3VhyHFwmTCsvE+K6+lqumN5Ub7OnybYaESa12PuPTUSTTLgRvJXdRbrZ UbH3En6Jx8dcuTR/eOBSJVdQE1entzYhw2EBB2fDyrhW/OcBIHHKqgiXZlxTXLYHOknf N7NQ== X-Gm-Message-State: AOAM533R/dvciYj4DtVHA/onjpzsJGZS7jZM8K9VfN8q6cc7xCECVO4L ZMvCBPcf+iI6gBMgYxt64JlqqiWUsAkPEt1elj0= X-Received: by 2002:a17:906:6b90:: with SMTP id l16mr11511853ejr.439.1624187897865; Sun, 20 Jun 2021 04:18:17 -0700 (PDT) MIME-Version: 1.0 References: <20210617093032.103097-1-dja@axtens.net> <20210617093032.103097-5-dja@axtens.net> In-Reply-To: <20210617093032.103097-5-dja@axtens.net> From: Andrey Konovalov Date: Sun, 20 Jun 2021 14:17:57 +0300 Message-ID: Subject: Re: [PATCH v15 4/4] kasan: use MAX_PTRS_PER_* for early shadow tables To: Daniel Axtens Cc: LKML , Linux Memory Management List , kasan-dev , Marco Elver , Andrew Morton , linuxppc-dev@lists.ozlabs.org, christophe.leroy@csgroup.eu, aneesh.kumar@linux.ibm.com, bsingharora@gmail.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 17, 2021 at 12:30 PM Daniel Axtens wrote: > > powerpc has a variable number of PTRS_PER_*, set at runtime based > on the MMU that the kernel is booted under. > > This means the PTRS_PER_* are no longer constants, and therefore > breaks the build. Switch to using MAX_PTRS_PER_*, which are constant. > > Suggested-by: Christophe Leroy > Suggested-by: Balbir Singh > Reviewed-by: Christophe Leroy > Reviewed-by: Balbir Singh > Reviewed-by: Marco Elver > Signed-off-by: Daniel Axtens > --- > include/linux/kasan.h | 6 +++--- > mm/kasan/init.c | 6 +++--- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/include/linux/kasan.h b/include/linux/kasan.h > index 768d7d342757..5310e217bd74 100644 > --- a/include/linux/kasan.h > +++ b/include/linux/kasan.h > @@ -41,9 +41,9 @@ struct kunit_kasan_expectation { > #endif > > extern unsigned char kasan_early_shadow_page[PAGE_SIZE]; > -extern pte_t kasan_early_shadow_pte[PTRS_PER_PTE + PTE_HWTABLE_PTRS]; > -extern pmd_t kasan_early_shadow_pmd[PTRS_PER_PMD]; > -extern pud_t kasan_early_shadow_pud[PTRS_PER_PUD]; > +extern pte_t kasan_early_shadow_pte[MAX_PTRS_PER_PTE + PTE_HWTABLE_PTRS]; > +extern pmd_t kasan_early_shadow_pmd[MAX_PTRS_PER_PMD]; > +extern pud_t kasan_early_shadow_pud[MAX_PTRS_PER_PUD]; > extern p4d_t kasan_early_shadow_p4d[MAX_PTRS_PER_P4D]; > > int kasan_populate_early_shadow(const void *shadow_start, > diff --git a/mm/kasan/init.c b/mm/kasan/init.c > index 348f31d15a97..cc64ed6858c6 100644 > --- a/mm/kasan/init.c > +++ b/mm/kasan/init.c > @@ -41,7 +41,7 @@ static inline bool kasan_p4d_table(pgd_t pgd) > } > #endif > #if CONFIG_PGTABLE_LEVELS > 3 > -pud_t kasan_early_shadow_pud[PTRS_PER_PUD] __page_aligned_bss; > +pud_t kasan_early_shadow_pud[MAX_PTRS_PER_PUD] __page_aligned_bss; > static inline bool kasan_pud_table(p4d_t p4d) > { > return p4d_page(p4d) == virt_to_page(lm_alias(kasan_early_shadow_pud)); > @@ -53,7 +53,7 @@ static inline bool kasan_pud_table(p4d_t p4d) > } > #endif > #if CONFIG_PGTABLE_LEVELS > 2 > -pmd_t kasan_early_shadow_pmd[PTRS_PER_PMD] __page_aligned_bss; > +pmd_t kasan_early_shadow_pmd[MAX_PTRS_PER_PMD] __page_aligned_bss; > static inline bool kasan_pmd_table(pud_t pud) > { > return pud_page(pud) == virt_to_page(lm_alias(kasan_early_shadow_pmd)); > @@ -64,7 +64,7 @@ static inline bool kasan_pmd_table(pud_t pud) > return false; > } > #endif > -pte_t kasan_early_shadow_pte[PTRS_PER_PTE + PTE_HWTABLE_PTRS] > +pte_t kasan_early_shadow_pte[MAX_PTRS_PER_PTE + PTE_HWTABLE_PTRS] > __page_aligned_bss; > > static inline bool kasan_pte_table(pmd_t pmd) > -- > 2.30.2 > Reviewed-by: Andrey Konovalov