Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp280402pxj; Thu, 17 Jun 2021 02:33:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDOspdVd7vHCYJWfsS2J8/0TLQVYU6hQMqhW78PEnJDLW50f5lpBNrWES8USQlgqecjpmB X-Received: by 2002:a92:c503:: with SMTP id r3mr2968542ilg.4.1623922389931; Thu, 17 Jun 2021 02:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623922389; cv=none; d=google.com; s=arc-20160816; b=K/JgSMveKNheSf1iYv58Tg+l0YUKnUVUg9sXupm0Io0wGjDdTyI1CnPLUkpOYrx3PU 27mYVYmHhpp+OMgZvbL8rXkF0N9oVDufklhup9nzBCJ8PlcNWs2NVrdQTEvXkFejAbBC sHFYlyvtxUyPJW8Y/zx7EKW69p4VgsPm2rX6oCqN6kVlRR5dpqsDw7W7PMQZVNzQN2Kt DTboj6/M5hLxZZnsPZMrhJwx7U6ZFToF83hHSxbOGXEiERLodq7IaJq59zQIs0hynbFw vgHenogSPFNmKrxOFNytlQqYeZ9VFe0lkGux5dGaSrusC7fhbjpgpNoFEEfnkFzJ8LRN abPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lssK+06OrqYXMI/RYJk+NygLCQ6hQhXYMHdalKVel+U=; b=kqCg0v/gosqL/QLvSyItYGypxH0bertsfduoZlp/8RJA/Wb8Ribp59UZftC9taR7fC va9i5AflZlepye2MszZvkymoqWZdqFiUPK7YNQFJT4srS112t29h3KgrirJxLbR8omBP Y50DiM1MJ2KEG7IqZBcWPKtWNkokQdvh4qGYZxlxdEtMzNpq2yuKEc4iT4j16f4yu58g lXBIahHav7hCHJbUQziHGKDWWw3HINInJYpMCeJYRdTyqQveyik/MRzYPEd2Jz8jRxWW q7rV4OODz5iAnW+GoECr9u1TIgqGF+VL39JEYTermi+1GuHTyd/f7ZpV/sIT3ziHy28v 1Usg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@axtens.net header.s=google header.b=ApqW+b4w; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a2si5560594jaq.37.2021.06.17.02.32.55; Thu, 17 Jun 2021 02:33:09 -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=@axtens.net header.s=google header.b=ApqW+b4w; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231661AbhFQJd0 (ORCPT + 99 others); Thu, 17 Jun 2021 05:33:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231669AbhFQJdR (ORCPT ); Thu, 17 Jun 2021 05:33:17 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E6C7C061768 for ; Thu, 17 Jun 2021 02:30:56 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id t17so4480640pga.5 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=eB+M3mQ2DqECzfJc2SW5T6fMRsLwm3ZpaRNqLjd8v7AME7PQ7nVioCCDJaN9QgmuE1 w1eQ2w2U1X2SR16yTqH2dVaz77JfPEF5fyqrW4miwhvoadnIVoPWfLkEvujf8W9ys252 Z5ZvDqIjUxMcyfiIMjV0XGhXGU4WijBymk7HNcgBywg8cMGyjfrKSdbaYOGowug0C46F mIku3gM21AXHkIIZtF5eGN3teZF7Skv52RA0dqK3R+tNs1JSBcPgOv0FSAb3Ur2QV87o /T+e0C9pIE8UBvUzI48FZ1vw0B7VUhlQ8riU8Y+gt2xTzyRYh7rtEwG0ujCsPkylS0n/ B4mQ== X-Gm-Message-State: AOAM531z0p8IdaQkKQ9MFgqohEGEmLYSyM/+eNXya94tDO2XCe69wzeR TqT3CU9JJtVUMjGJtiIIhIP2LdB7SzVvmw== 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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