From patchwork Thu Jun 17 06:39:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 12326867 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.6 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,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 D2A98C2B9F4 for ; Thu, 17 Jun 2021 06:40:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8630F613D5 for ; Thu, 17 Jun 2021 06:40:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8630F613D5 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 3023E6B0074; Thu, 17 Jun 2021 02:40:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B2596B0075; Thu, 17 Jun 2021 02:40:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 106856B0078; Thu, 17 Jun 2021 02:40:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D28186B0074 for ; Thu, 17 Jun 2021 02:40:22 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 66C7F181AEF00 for ; Thu, 17 Jun 2021 06:40:22 +0000 (UTC) X-FDA: 78262266684.03.9B3193A Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by imf24.hostedemail.com (Postfix) with ESMTP id 4DDA6A00025C for ; Thu, 17 Jun 2021 06:40:11 +0000 (UTC) Received: by mail-pg1-f171.google.com with SMTP id w31so4128601pga.6 for ; Wed, 16 Jun 2021 23:40:21 -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=eRdt/wFzvgUcAph19a7+La8R0pqDnXPYkPybGzP3TFs=; b=LW8mQ1aUFkj03n/RiqJV2xkT3exIY4LtDgccB7rozmA2OQfAiuVQxboDoQGry9XmzT Rw6MVtymYZEzC5bYdmJ+4EYgpjgqjhkzeSU5agu/yHfWJlU7hk6D7ZBbs+2zPDD71A5N pfCmsHWyxSHDaUWlivIYJVqE4KttoIxL2Gvx8= 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=eRdt/wFzvgUcAph19a7+La8R0pqDnXPYkPybGzP3TFs=; b=kvGjBNNeqDcPv1sZG3nLnl72D71zlxmEX2GJtIDJbr6P1rxUKflWnS+S3iY/pxh4xQ 26BcveyZj4LcufAk+BWJLQ97fb+zzG3vgWjJxJYvkl9R/Sv+iJZYaPwbMhm4Vc8fojw2 qBPB3cFn0ooVnRLqHy462mRiexC+jiaEqvTs8l17t1PEKLcQDDDmoI5p7RJPrz1Vr/fS woaoZ0oYfIgHj2sEGjxssgD2cKlxEhOB8tBSKEMbvbNFkjbKxb58V106qvGXLTvKWmX3 0afm2a7Q8KrvQ8cl19cfqKwauvoRPriv5xNujUrE4v3jBBOFnOEOM8gtyniNzv793oRF yA8Q== X-Gm-Message-State: AOAM531EjQMOkY623RYL0g8IftaxncoiJBg84G7iXmOy/D57HvNWW0t4 X2WpxgCIIZoqb1NFASm6TIRzzA== X-Google-Smtp-Source: ABdhPJxZ8JWJ4Mjr5ash2IXA6R5rV4gGGXHwovDZyw0LOK/tt3IT1XtCKUzvjMkiK2XZ7DVnqYtOEA== X-Received: by 2002:a63:64a:: with SMTP id 71mr3578146pgg.360.1623912021307; Wed, 16 Jun 2021 23:40:21 -0700 (PDT) Received: from localhost ([203.206.29.204]) by smtp.gmail.com with ESMTPSA id o34sm717337pgm.6.2021.06.16.23.40.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 23:40:21 -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 v14 4/4] kasan: use MAX_PTRS_PER_* for early shadow tables Date: Thu, 17 Jun 2021 16:39:56 +1000 Message-Id: <20210617063956.94061-5-dja@axtens.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210617063956.94061-1-dja@axtens.net> References: <20210617063956.94061-1-dja@axtens.net> MIME-Version: 1.0 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=axtens.net header.s=google header.b=LW8mQ1aU; dmarc=none; spf=pass (imf24.hostedemail.com: domain of dja@axtens.net designates 209.85.215.171 as permitted sender) smtp.mailfrom=dja@axtens.net X-Rspamd-Server: rspam02 X-Stat-Signature: 8bkd4y5b4oppkr7xgpjdx7su5gyfhjqz X-Rspamd-Queue-Id: 4DDA6A00025C X-HE-Tag: 1623912011-72035 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 Signed-off-by: Daniel Axtens Reviewed-by: Marco Elver --- 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)