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]
Message-ID: <20200507135213.GA32706@willie-the-truck>
Date:   Thu, 7 May 2020 14:52:14 +0100
From:   Will Deacon <will@...nel.org>
To:     Yunfeng Ye <yeyunfeng@...wei.com>
Cc:     catalin.marinas@....com, Dave.Martin@....com, mark.rutland@....com,
        james.morse@....com, 0x7f454c46@...il.com, tglx@...utronix.de,
        lorenzo.pieralisi@....com, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org, hushiyuan@...wei.com,
        hewenliang4@...wei.com
Subject: Re: [PATCH] arm64: stacktrace: Factor out some common code info
 on_stack()

On Thu, May 07, 2020 at 05:28:19PM +0800, Yunfeng Ye wrote:
> diff --git a/arch/arm64/include/asm/stacktrace.h b/arch/arm64/include/asm/stacktrace.h
> index fdb913cc0bcb..b92bef2fb6cd 100644
> --- a/arch/arm64/include/asm/stacktrace.h
> +++ b/arch/arm64/include/asm/stacktrace.h
> @@ -69,27 +69,40 @@ extern void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk,
> 
>  DECLARE_PER_CPU(unsigned long *, irq_stack_ptr);
> 
> -static inline bool on_irq_stack(unsigned long sp,
> +static inline bool on_stack(unsigned long sp, unsigned long low,
> +				unsigned long high, enum stack_type type,
>  				struct stack_info *info)
>  {
> -	unsigned long low = (unsigned long)raw_cpu_read(irq_stack_ptr);
> -	unsigned long high = low + IRQ_STACK_SIZE;
> -
> -	if (!low)
> -		return false;
> -
>  	if (sp < low || sp >= high)
>  		return false;
> 
>  	if (info) {
>  		info->low = low;
>  		info->high = high;
> -		info->type = STACK_TYPE_IRQ;
> +		info->type = type;
>  	}
> -
>  	return true;
>  }
> 
> +static inline bool on_valid_stack(unsigned long sp, unsigned long low,
> +				unsigned long high, enum stack_type type,
> +				struct stack_info *info)
> +{
> +	if (!low)
> +		return false;
> +
> +	return on_stack(sp, low, high, type, info);
> +}

Do we need this as distinct from on_stack()? Afaict, 'low' is never
going to be NULL for the on_stack() callers, so I suggest just having
on_stack() check 'low' and getting everybody to call that instead.

Make sense?

Will

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ