lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 24 Sep 2021 09:01:33 +0530
From:   Anshuman Khandual <anshuman.khandual@....com>
To:     guoren@...nel.org, akpm@...ux-foundation.org
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        Guo Ren <guoren@...ux.alibaba.com>
Subject: Re: [PATCH] mm: debug_vm_pgtable: Don't use __P000 directly

Hello Guo,

On 9/22/21 1:48 AM, guoren@...nel.org wrote:
> From: Guo Ren <guoren@...ux.alibaba.com>
> 
> The __Pxxx/__Sxxx macros are only for init protection_map[]. All

s/init protection_map[]/protection_map[] int/

Or rephrase with something similar.

> usage of them in linux should come from protection_map array.

Agreed.

> 
> Becasue a lot of architectures would re-initilize protection_map[]

s/Becasue/Because/

./scripts/checkpatch.pl ./0001-mm-debug_vm_pgtable-Don-t-use-__P000-directly.patch 
WARNING: 'Becasue' may be misspelled - perhaps 'Because'?
#9: 
Becasue a lot of architectures would re-initilize protection_map[]
^^^^^^^

total: 0 errors, 1 warnings, 15 lines checked

> array, eg: x86-mem_encrypt, m68k-motorola, mips, arm, sparc.
> 
> Using __P000 maybe won't cause bug because hw would deny access

Not very clear. Could you please rephrase.

> with PROT_NONE permission, but it's not rigorous.

Agreed.

> 
> Signed-off-by: Guo Ren <guoren@...ux.alibaba.com>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> ---
>  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

Please just replace __P000 and __S000 with protection_map[0] and
protection_map[8] respectively. Also reformat this comment section
if required.

>  	 * 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;
> 

With the above changes in place.

Reviewed-by: Anshuman Khandual <anshuman.khandual@....com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ