From patchwork Tue Sep 21 20:18:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guo Ren X-Patchwork-Id: 12508701 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 6D81CC433F5 for ; Tue, 21 Sep 2021 20:18:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 03D5561131 for ; Tue, 21 Sep 2021 20:18:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 03D5561131 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 4C9AA6B006C; Tue, 21 Sep 2021 16:18:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 479256B0071; Tue, 21 Sep 2021 16:18:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 36758900002; Tue, 21 Sep 2021 16:18:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0024.hostedemail.com [216.40.44.24]) by kanga.kvack.org (Postfix) with ESMTP id 265316B006C for ; Tue, 21 Sep 2021 16:18:37 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D4F4C8249980 for ; Tue, 21 Sep 2021 20:18:36 +0000 (UTC) X-FDA: 78612693432.04.6898CC1 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf30.hostedemail.com (Postfix) with ESMTP id 7043DE00198F for ; Tue, 21 Sep 2021 20:18:36 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 1FE6B60EFF; Tue, 21 Sep 2021 20:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632255515; bh=EmEce8xEvkne8kSGvU6PQeWU4jkLv8xqRMb6teYSXMs=; h=From:To:Cc:Subject:Date:From; b=lAGORjBiBXR8ZKsDwksEUwyz0UrJM+xi1OMGRRcnRt2nqzk7ui6u5Zqyysu5rHyXM NYPUvFoZu4NN8pyYaFVzqD1LXVI12gmDoj6Z9xkyPWYVZYOZc/i1zNGUuHJcnp9AKy E0M4ME91UZnBYN7rEgjM2m8xB0BZGiMNfzZdKD+dfzxpHrACZoMnw+sJMshMtaza6a uNfqT1OXihIzm5QGNWcIiWOkCRdinRT3yskudDO+FuVPkc7vNFOyreUgQJ6550UXe0 rhjfzmmSGMs2UeEZqil1UjVEweclg6mrreW01rCxpZhVuv3p1/jyRsaDLKb40h5Ym4 3McR48kF+dljQ== From: guoren@kernel.org To: guoren@kernel.org, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Guo Ren Subject: [PATCH] mm: debug_vm_pgtable: Don't use __P000 directly Date: Wed, 22 Sep 2021 04:18:15 +0800 Message-Id: <20210921201815.284412-1-guoren@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=lAGORjBi; spf=pass (imf30.hostedemail.com: domain of guoren@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=guoren@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Stat-Signature: 6zn8cmb8i78uiedsoygzfpjoh8wmo9yo X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 7043DE00198F X-HE-Tag: 1632255516-373011 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: From: Guo Ren The __Pxxx/__Sxxx macros are only for init protection_map[]. All usage of them in linux should come from protection_map array. Becasue a lot of architectures would re-initilize protection_map[] array, eg: x86-mem_encrypt, m68k-motorola, mips, arm, sparc. Using __P000 maybe won't cause bug because hw would deny access with PROT_NONE permission, but it's not rigorous. Signed-off-by: Guo Ren Cc: Andrew Morton Reviewed-by: Anshuman Khandual --- mm/debug_vm_pgtable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index 1403639302e4..a6ebbf6e53dd 100644 --- a/mm/debug_vm_pgtable.c +++ b/mm/debug_vm_pgtable.c @@ -1104,13 +1104,13 @@ static int __init init_args(struct pgtable_debug_args *args) /* * Initialize the debugging data. * - * __P000 (or even __S000) will help create page table entries with + * __P000 (protection_map[0]) will help create page table entries with * PROT_NONE permission as required for pxx_protnone_tests(). */ memset(args, 0, sizeof(*args)); args->vaddr = get_random_vaddr(); args->page_prot = vm_get_page_prot(VMFLAGS); - args->page_prot_none = __P000; + args->page_prot_none = protection_map[0]; args->is_contiguous_page = false; args->pud_pfn = ULONG_MAX; args->pmd_pfn = ULONG_MAX;