mm: debug_vm_pgtable: don't use __P000 directly

Bugzilla: https://bugzilla.redhat.com/2120352

commit 8772716f96704c67b1e2a6ba175605b4fce2a252
Author: Guo Ren <guoren@linux.alibaba.com>
Date:   Fri Nov 5 13:36:09 2021 -0700

    mm: debug_vm_pgtable: don't use __P000 directly

    The __Pxxx/__Sxxx macros are only for protection_map[] init.  All usage
    of them in linux should come from protection_map array.

    Because a lot of architectures would re-initilize protection_map[]
    array, eg: x86-mem_encrypt, m68k-motorola, mips, arm, sparc.

    Using __P000 is not rigorous.

    Link: https://lkml.kernel.org/r/20210924060821.1138281-1-guoren@kernel.org
    Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
    Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
    Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Cc: Gavin Shan <gshan@redhat.com>
    Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
    Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
This commit is contained in:
Chris von Recklinghausen 2022-10-12 07:08:18 -04:00
parent 89c83b3ac9
commit 1e19113a7a
1 changed files with 4 additions and 3 deletions

View File

@ -1106,13 +1106,14 @@ 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
* PROT_NONE permission as required for pxx_protnone_tests().
* protection_map[0] (or even protection_map[8]) 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;