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] [day] [month] [year] [list]
Message-ID: <f26804cf-e342-5826-8f01-4b087a7baa63@arm.com>
Date:   Tue, 28 Jun 2022 08:42:24 +0530
From:   Anshuman Khandual <anshuman.khandual@....com>
To:     Sam Ravnborg <sam@...nborg.org>
Cc:     linux-mm@...ck.org, hch@...radead.org, christophe.leroy@...roup.eu,
        Andrew Morton <akpm@...ux-foundation.org>,
        linuxppc-dev@...ts.ozlabs.org, sparclinux@...r.kernel.org,
        x86@...nel.org, openrisc@...ts.librecores.org,
        linux-xtensa@...ux-xtensa.org, linux-csky@...r.kernel.org,
        linux-hexagon@...r.kernel.org, linux-parisc@...r.kernel.org,
        linux-alpha@...r.kernel.org, linux-riscv@...ts.infradead.org,
        linux-s390@...r.kernel.org, linux-ia64@...r.kernel.org,
        linux-mips@...r.kernel.org, linux-m68k@...ts.linux-m68k.org,
        linux-snps-arc@...ts.infradead.org,
        linux-arm-kernel@...ts.infradead.org, linux-um@...ts.infradead.org,
        linux-sh@...r.kernel.org, linux-kernel@...r.kernel.org,
        "David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH V5 04/26] sparc/mm: Move protection_map[] inside the
 platform



On 6/27/22 22:44, Sam Ravnborg wrote:
> Hi Anshuman,
> 
> On Mon, Jun 27, 2022 at 10:28:11AM +0530, Anshuman Khandual wrote:
>> This moves protection_map[] inside the platform and while here, also enable
>> ARCH_HAS_VM_GET_PAGE_PROT on 32 bit platforms via DECLARE_VM_GET_PAGE_PROT.
>>
>> Cc: "David S. Miller" <davem@...emloft.net>
>> Cc: sparclinux@...r.kernel.org
>> Cc: linux-kernel@...r.kernel.org
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@....com>
>> ---
>>  arch/sparc/Kconfig                  |  2 +-
>>  arch/sparc/include/asm/pgtable_32.h | 19 -------------------
>>  arch/sparc/include/asm/pgtable_64.h | 19 -------------------
>>  arch/sparc/mm/init_32.c             | 20 ++++++++++++++++++++
>>  arch/sparc/mm/init_64.c             |  3 +++
>>  5 files changed, 24 insertions(+), 39 deletions(-)
>>
>> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
>> index ba449c47effd..09f868613a4d 100644
>> --- a/arch/sparc/Kconfig
>> +++ b/arch/sparc/Kconfig
>> @@ -13,6 +13,7 @@ config 64BIT
>>  config SPARC
>>  	bool
>>  	default y
>> +	select ARCH_HAS_VM_GET_PAGE_PROT
>>  	select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI
>>  	select ARCH_MIGHT_HAVE_PC_SERIO
>>  	select DMA_OPS
>> @@ -84,7 +85,6 @@ config SPARC64
>>  	select PERF_USE_VMALLOC
>>  	select ARCH_HAVE_NMI_SAFE_CMPXCHG
>>  	select HAVE_C_RECORDMCOUNT
>> -	select ARCH_HAS_VM_GET_PAGE_PROT
>>  	select HAVE_ARCH_AUDITSYSCALL
>>  	select ARCH_SUPPORTS_ATOMIC_RMW
>>  	select ARCH_SUPPORTS_DEBUG_PAGEALLOC
>> diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
>> index 4866625da314..8ff549004fac 100644
>> --- a/arch/sparc/include/asm/pgtable_32.h
>> +++ b/arch/sparc/include/asm/pgtable_32.h
>> @@ -64,25 +64,6 @@ void paging_init(void);
>>  
>>  extern unsigned long ptr_in_current_pgd;
>>  
>> -/*         xwr */
>> -#define __P000  PAGE_NONE
>> -#define __P001  PAGE_READONLY
>> -#define __P010  PAGE_COPY
>> -#define __P011  PAGE_COPY
>> -#define __P100  PAGE_READONLY
>> -#define __P101  PAGE_READONLY
>> -#define __P110  PAGE_COPY
>> -#define __P111  PAGE_COPY
>> -
>> -#define __S000	PAGE_NONE
>> -#define __S001	PAGE_READONLY
>> -#define __S010	PAGE_SHARED
>> -#define __S011	PAGE_SHARED
>> -#define __S100	PAGE_READONLY
>> -#define __S101	PAGE_READONLY
>> -#define __S110	PAGE_SHARED
>> -#define __S111	PAGE_SHARED
>> -
>>  /* First physical page can be anywhere, the following is needed so that
>>   * va-->pa and vice versa conversions work properly without performance
>>   * hit for all __pa()/__va() operations.
>> diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
>> index 4679e45c8348..a779418ceba9 100644
>> --- a/arch/sparc/include/asm/pgtable_64.h
>> +++ b/arch/sparc/include/asm/pgtable_64.h
>> @@ -187,25 +187,6 @@ bool kern_addr_valid(unsigned long addr);
>>  #define _PAGE_SZHUGE_4U	_PAGE_SZ4MB_4U
>>  #define _PAGE_SZHUGE_4V	_PAGE_SZ4MB_4V
>>  
>> -/* These are actually filled in at boot time by sun4{u,v}_pgprot_init() */
>> -#define __P000	__pgprot(0)
>> -#define __P001	__pgprot(0)
>> -#define __P010	__pgprot(0)
>> -#define __P011	__pgprot(0)
>> -#define __P100	__pgprot(0)
>> -#define __P101	__pgprot(0)
>> -#define __P110	__pgprot(0)
>> -#define __P111	__pgprot(0)
>> -
>> -#define __S000	__pgprot(0)
>> -#define __S001	__pgprot(0)
>> -#define __S010	__pgprot(0)
>> -#define __S011	__pgprot(0)
>> -#define __S100	__pgprot(0)
>> -#define __S101	__pgprot(0)
>> -#define __S110	__pgprot(0)
>> -#define __S111	__pgprot(0)
>> -
>>  #ifndef __ASSEMBLY__
>>  
>>  pte_t mk_pte_io(unsigned long, pgprot_t, int, unsigned long);
>> diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
>> index 1e9f577f084d..8693e4e28b86 100644
>> --- a/arch/sparc/mm/init_32.c
>> +++ b/arch/sparc/mm/init_32.c
>> @@ -302,3 +302,23 @@ void sparc_flush_page_to_ram(struct page *page)
>>  		__flush_page_to_ram(vaddr);
>>  }
>>  EXPORT_SYMBOL(sparc_flush_page_to_ram);
>> +
>> +static pgprot_t protection_map[16] __ro_after_init = {
> This can be const - like done for powerpc and others.
> sparc32 and sparc64 uses each their own - and I do not see sparc32 do
> any modifications to protection_map.

Indeed protection_map[] arrays are independent both for sparc32 and spacr64.
sparc32 platform never changes the protection_map[] array during boot. Sure,
will make it into a const instead. Thanks for pointing this out.

> 
> With this change:
> Reviewed-by: Sam Ravnborg <sam@...nborg.org>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ