[PATCHv4 14/17] arm64: uaccess: remove set_fs()

James Morse james.morse at arm.com
Thu Nov 26 13:42:26 EST 2020


Hi Mark,

On 13/11/2020 12:49, Mark Rutland wrote:
> Now that the uaccess primitives dont take addr_limit into acccount, we

(account)


>  #if defined(CONFIG_ARM64_64K_PAGES) && defined(CONFIG_KUSER_HELPERS)
> diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h
> index 2547d94634be..2bb53bc3c326 100644
> --- a/arch/arm64/include/asm/ptrace.h
> +++ b/arch/arm64/include/asm/ptrace.h
> @@ -193,8 +193,7 @@ struct pt_regs {
>  	s32 syscallno;
>  	u32 unused2;
>  #endif
> -
> -	u64 orig_addr_limit;
> +	u64 sdei_ttbr1;
>  	/* Only valid when ARM64_HAS_IRQ_PRIO_MASKING is enabled. */
>  	u64 pmr_save;
>  	u64 stackframe[2];

Hmmm,


> diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
> index b295fb912b12..bdd3b57b12f5 100644
> --- a/arch/arm64/kernel/entry.S
> +++ b/arch/arm64/kernel/entry.S
> @@ -999,10 +987,9 @@ SYM_CODE_START(__sdei_asm_entry_trampoline)
>  	mov	x4, xzr
>  
>  	/*
> -	 * Use reg->interrupted_regs.addr_limit to remember whether to unmap
> -	 * the kernel on exit.
> +	 * Remember whether to unmap the kernel on exit.
>  	 */
> -1:	str	x4, [x1, #(SDEI_EVENT_INTREGS + S_ORIG_ADDR_LIMIT)]
> +1:	str	x4, [x1, #(SDEI_EVENT_INTREGS + S_SDEI_TTBR1)]
>  
>  #ifdef CONFIG_RANDOMIZE_BASE
>  	adr	x4, tramp_vectors + PAGE_SIZE
> @@ -1023,7 +1010,7 @@ NOKPROBE(__sdei_asm_entry_trampoline)
>   * x4: struct sdei_registered_event argument from registration time.
>   */
>  SYM_CODE_START(__sdei_asm_exit_trampoline)
> -	ldr	x4, [x4, #(SDEI_EVENT_INTREGS + S_ORIG_ADDR_LIMIT)]
> +	ldr	x4, [x4, #(SDEI_EVENT_INTREGS + S_SDEI_TTBR1)]
>  	cbnz	x4, 1f
>  
>  	tramp_unmap_kernel	tmp=x4

Ah, that. This was previously abusing orig_addr_limit as the space was already there, and
if you squint....

Now it seems odd to waste that space in every pt_regs given its only needed in here, but
its still needed for padding. If more padding ever turns up I'll add cleaning this up to
my todo list.


Acked-by: James Morse <james.morse at arm.com>


Thanks,

James



More information about the linux-arm-kernel mailing list