From patchwork Thu Jun 17 09:30:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 12327111 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 33990C2B9F4 for ; Thu, 17 Jun 2021 09:30:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D0BE7610CA for ; Thu, 17 Jun 2021 09:30:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D0BE7610CA 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 74B496B0074; Thu, 17 Jun 2021 05:30:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 721766B0075; Thu, 17 Jun 2021 05:30:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C2A86B0078; Thu, 17 Jun 2021 05:30:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id 2E2156B0074 for ; Thu, 17 Jun 2021 05:30:57 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B902D180AD804 for ; Thu, 17 Jun 2021 09:30:56 +0000 (UTC) X-FDA: 78262696512.40.B450DB8 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by imf17.hostedemail.com (Postfix) with ESMTP id 9268B4202A0E for ; Thu, 17 Jun 2021 09:30:48 +0000 (UTC) Received: by mail-pf1-f173.google.com with SMTP id k15so4537040pfp.6 for ; Thu, 17 Jun 2021 02:30:56 -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=lssK+06OrqYXMI/RYJk+NygLCQ6hQhXYMHdalKVel+U=; b=ApqW+b4wR3tXMa534EPaBXG3/a/Hp08qg47DiHJtK0mgfEzFsiG1Ao4n68XSbDDzxZ 9xXHIEqvn94lOxSRnTRB/+vsb0DyGcdYekj3LvN+7sN7No/pDmeLXun8PSncAf7BVTvs 3fWwD8exglZRS+hl5MRe5QjV1DWRuF2+sp7mc= 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=lssK+06OrqYXMI/RYJk+NygLCQ6hQhXYMHdalKVel+U=; b=HCnkft0qkSSIDb9Wicj3TEQuwOwb3abpQjHHi+w7NBhi3AHEg+bODfcRDTSzzbeReP LLQ4atLoxgCjc3xMaZGbK/ba+/b43qWrjPFxX501SSnfFWbB9BhEi3O3gYcY94D5Oepc 3io9E/ioeGQ++lX5ewGGiibFSwTTZR/hDlkEBs6aC0ggTiwpREh1GQineQg3xq+GIrhT Vhr0DVzqFwXRMB+uK+UCvBFly4O5ZOFdBBYcEXNmP75XyO+luHmoaaKLEfPYRLan+4cp fWx1h2BiS4Z/p3AxvolB2W2j1fD2yCtBCdIwESx0V+Gugu0W2qpr90emN/YKfdnF9tGv Rwqw== X-Gm-Message-State: AOAM532cXg9l++nrx2U2WSL2kswv/egfDBHBeoJeiIDdSK9+oB21O4mN vLxXjzrfagCSvJr/hC75KTB1Eg== X-Google-Smtp-Source: ABdhPJz6OUBNln7eU/91Mj+ScyWERfC5hrYLY7B9BZavgiJtBCoiFIgMEfAytW77+pj2ssxxHF0OIA== X-Received: by 2002:a63:db01:: with SMTP id e1mr4204540pgg.38.1623922255699; Thu, 17 Jun 2021 02:30:55 -0700 (PDT) Received: from localhost ([203.206.29.204]) by smtp.gmail.com with ESMTPSA id o14sm4847028pgk.82.2021.06.17.02.30.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 02:30:55 -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 v15 4/4] kasan: use MAX_PTRS_PER_* for early shadow tables Date: Thu, 17 Jun 2021 19:30:32 +1000 Message-Id: <20210617093032.103097-5-dja@axtens.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210617093032.103097-1-dja@axtens.net> References: <20210617093032.103097-1-dja@axtens.net> MIME-Version: 1.0 Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=axtens.net header.s=google header.b=ApqW+b4w; spf=pass (imf17.hostedemail.com: domain of dja@axtens.net designates 209.85.210.173 as permitted sender) smtp.mailfrom=dja@axtens.net; dmarc=none X-Stat-Signature: wcn9fi57zb4qbgypejsfmimg8ifrrdgy X-Rspamd-Queue-Id: 9268B4202A0E X-Rspamd-Server: rspam06 X-HE-Tag: 1623922248-402892 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 Signed-off-by: Daniel Axtens Reviewed-by: Andrey Konovalov --- 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)