From patchwork Thu Jun 24 03:40:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 12340755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34B4AC49EA5 for ; Thu, 24 Jun 2021 03:41:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D9523613C0 for ; Thu, 24 Jun 2021 03:41:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D9523613C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E060A6B0093; Wed, 23 Jun 2021 23:41:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DDCA66B0095; Wed, 23 Jun 2021 23:41:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA5786B0096; Wed, 23 Jun 2021 23:41:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0161.hostedemail.com [216.40.44.161]) by kanga.kvack.org (Postfix) with ESMTP id 9B8166B0093 for ; Wed, 23 Jun 2021 23:41:14 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C2CBD181AEF31 for ; Thu, 24 Jun 2021 03:41:14 +0000 (UTC) X-FDA: 78287216868.16.AD8F7DA Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by imf14.hostedemail.com (Postfix) with ESMTP id 7C5A7C00CBD7 for ; Thu, 24 Jun 2021 03:41:14 +0000 (UTC) Received: by mail-pg1-f178.google.com with SMTP id p9so3595665pgb.1 for ; Wed, 23 Jun 2021 20:41:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ctu6eGIgdooF8iPxRHw2B5UaQhrklgx8o8kc13VGL+0=; b=FooYSsrf/byfUjHr9v8Z5dcDSMVq+aOy9Zw2Y6OY+wiqjx/RpBD79cPIN4lJXSGXs3 4+vPSeNPFJMweHYJew6Xa77gKY1t6pM6NkcMtoX1pvl3TEEEFl8TL9aVfMp/WVgF0LL3 BRf01yjVSdrvlKtMN7gA78LXgbINNraud8dis= 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:mime-version:content-transfer-encoding; bh=Ctu6eGIgdooF8iPxRHw2B5UaQhrklgx8o8kc13VGL+0=; b=qCjQKyjpJH0Iwz2SVF5wM5XdlpNKBGzL52hkojjXPYG0JUmy4ee5lhqCKsB7M2NB5m h8OwQe+5GLC3DIt59W5KLiQscSdd1AAuk4yaxm83v7XZG4mTyulq+3c+N+pWjzkycPKD jZpmeh7y1zLioJhVhziLEf6mJ7Qsa6m0SIOPz2f+QSceeFqWM52K1od4pRBtjR4TNdYk Iuey0sX1o0qtY0P+y1AtdIGf9cq/Z7pVEhIf/Gi/G9dcchZ/jOHL1ZeKqSLxr8mpz4sR PUw40JQvBgd7clRvyC1K+rV1GlU+co4IzVVXQ3LQsT41iBotvOekShsiLOuQPDV34Qnx +bGQ== X-Gm-Message-State: AOAM5313bxwIt1UCDB1YP392SNR55CWZyFJzdXFHdkeW1OcZMeimzdUc viuS/3Nwo3E/UErjoTjQSD6I8Q== X-Google-Smtp-Source: ABdhPJzyemWeDjYSvtIVYwsIq1X0bowWLkR1TGinCknV//VarDM6vRNV9QrEYKNeX2yQiXYPgJ/wAQ== X-Received: by 2002:a62:1657:0:b029:301:af69:5ae3 with SMTP id 84-20020a6216570000b0290301af695ae3mr2929381pfw.57.1624506073704; Wed, 23 Jun 2021 20:41:13 -0700 (PDT) Received: from localhost ([203.206.29.204]) by smtp.gmail.com with ESMTPSA id n69sm1160501pfd.132.2021.06.23.20.41.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 20:41:13 -0700 (PDT) From: Daniel Axtens To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kasan-dev@googlegroups.com, elver@google.com, akpm@linux-foundation.org, andreyknvl@gmail.com Cc: linuxppc-dev@lists.ozlabs.org, christophe.leroy@csgroup.eu, aneesh.kumar@linux.ibm.com, bsingharora@gmail.com, Daniel Axtens Subject: [PATCH v16 4/4] kasan: use MAX_PTRS_PER_* for early shadow tables Date: Thu, 24 Jun 2021 13:40:50 +1000 Message-Id: <20210624034050.511391-5-dja@axtens.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210624034050.511391-1-dja@axtens.net> References: <20210624034050.511391-1-dja@axtens.net> MIME-Version: 1.0 Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=axtens.net header.s=google header.b=FooYSsrf; dmarc=none; spf=pass (imf14.hostedemail.com: domain of dja@axtens.net designates 209.85.215.178 as permitted sender) smtp.mailfrom=dja@axtens.net X-Rspamd-Server: rspam02 X-Stat-Signature: oh4b6dh69dze4pn7tue1w61783dqqqgo X-Rspamd-Queue-Id: 7C5A7C00CBD7 X-HE-Tag: 1624506074-182330 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reviewed-by: Andrey Konovalov 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)