Re: [PATCH 5.15 000/923] 5.15.3-rc3 review

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

 



On Thu, Nov 18, 2021 at 10:39:44AM +0100, Peter Zijlstra wrote:
> @@ -396,22 +416,27 @@ static bool deref_stack_iret_regs(struct unwind_state *state, unsigned long addr
>  static bool get_reg(struct unwind_state *state, unsigned int reg_off,
>  		    unsigned long *val)
>  {
> -	unsigned int reg = reg_off/8;
> -
>  	if (!state->regs)
>  		return false;
>  
> +	pagefault_disable();
>  	if (state->full_regs) {
> -		*val = READ_ONCE_NOCHECK(((unsigned long *)state->regs)[reg]);
> +		__get_kernel_nofault(val, (void *)state->regs + reg_off, unsigned long, Efault);
> +		pagefault_enable();
>  		return true;
>  	}
>  
>  	if (state->prev_regs) {
> -		*val = READ_ONCE_NOCHECK(((unsigned long *)state->prev_regs)[reg]);
> +		__get_kernel_nofault(val, (void *)state->regs + reg_off, unsigned long, Efault);
							^^^ prev_regs
> +		pagefault_enable();
>  		return true;
>  	}
>  
>  	return false;
> +
> +Efault:
> +	pagefault_enable();
> +	return false;
>  }



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux