Re: [PATCH RFC 01/17] arm64: consolidate rox page protection logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 30, 2023 at 03:04:35PM +0100, Russell King (Oracle) wrote:
> Consolidate the arm64 decision making for the page protections used
> for executable pages, used by both the trampoline code and the kernel
> text mapping code.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@xxxxxxxxxxxxxxx>

It seems nice to ensure this is consistent, so regardless of whether we want
the series as a whole:

Acked-by: Mark Rutland <mark.rutland@xxxxxxx>

Mark.

> ---
>  arch/arm64/mm/mmu.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index af6bc8403ee4..4829abe017e9 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -663,12 +663,17 @@ static void __init map_kernel_segment(pgd_t *pgdp, void *va_start, void *va_end,
>  	vm_area_add_early(vma);
>  }
>  
> +static pgprot_t kernel_exec_prot(void)
> +{
> +	return rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC;
> +}
> +
>  #ifdef CONFIG_UNMAP_KERNEL_AT_EL0
>  static int __init map_entry_trampoline(void)
>  {
>  	int i;
>  
> -	pgprot_t prot = rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC;
> +	pgprot_t prot = kernel_exec_prot();
>  	phys_addr_t pa_start = __pa_symbol(__entry_tramp_text_start);
>  
>  	/* The trampoline is always mapped and can therefore be global */
> @@ -723,7 +728,7 @@ static void __init map_kernel(pgd_t *pgdp)
>  	 * mapping to install SW breakpoints. Allow this (only) when
>  	 * explicitly requested with rodata=off.
>  	 */
> -	pgprot_t text_prot = rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC;
> +	pgprot_t text_prot = kernel_exec_prot();
>  
>  	/*
>  	 * If we have a CPU that supports BTI and a kernel built for
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux