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: <573E8FFB.3000107@linaro.org>
Date:	Fri, 20 May 2016 00:18:03 -0400
From:	David Long <dave.long@...aro.org>
To:	Huang Shijie <shijie.huang@....com>
Cc:	Catalin Marinas <catalin.marinas@....com>,
	Will Deacon <will.deacon@....com>,
	Sandeepa Prabhu <sandeepa.s.prabhu@...il.com>,
	William Cohen <wcohen@...hat.com>,
	Pratyush Anand <panand@...hat.com>,
	Steve Capper <steve.capper@...aro.org>,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	Marc Zyngier <marc.zyngier@....com>,
	Mark Rutland <mark.rutland@....com>,
	Petr Mladek <pmladek@...e.com>,
	Viresh Kumar <viresh.kumar@...aro.org>,
	John Blackwood <john.blackwood@...r.com>,
	Feng Kan <fkan@....com>, Zi Shen Lim <zlim.lnx@...il.com>,
	Dave P Martin <Dave.Martin@....com>,
	Yang Shi <yang.shi@...aro.org>,
	Vladimir Murzin <Vladimir.Murzin@....com>,
	Kees Cook <keescook@...omium.org>,
	"Suzuki K. Poulose" <suzuki.poulose@....com>,
	Mark Brown <broonie@...nel.org>,
	Alex Bennée <alex.bennee@...aro.org>,
	Ard Biesheuvel <ard.biesheuvel@...aro.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Mark Salyzyn <salyzyn@...roid.com>,
	James Morse <james.morse@....com>,
	Christoffer Dall <christoffer.dall@...aro.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Robin Murphy <Robin.Murphy@....com>,
	Jens Wiklander <jens.wiklander@...aro.org>,
	Balamurugan Shanmugam <bshanmugam@....com>, nd@....com
Subject: Re: [PATCH v12 01/10] arm64: Add HAVE_REGS_AND_STACK_ACCESS_API
 feature

On 05/17/2016 05:14 AM, Huang Shijie wrote:
> On Wed, Apr 27, 2016 at 02:52:56PM -0400, David Long wrote:
>> From: "David A. Long" <dave.long@...aro.org>
>> +/**
>> + * regs_within_kernel_stack() - check the address in the stack
>> + * @regs:      pt_regs which contains kernel stack pointer.
>> + * @addr:      address which is checked.
>> + *
>> + * regs_within_kernel_stack() checks @addr is within the kernel stack page(s).
>> + * If @addr is within the kernel stack, it returns true. If not, returns false.
>> + */
>> +bool regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr)
>> +{
>> +	return ((addr & ~(THREAD_SIZE - 1))  ==
>> +		(kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1))) ||
>> +		on_irq_stack(addr, raw_smp_processor_id());
>> +}
>> +
>> +/**
>> + * regs_get_kernel_stack_nth() - get Nth entry of the stack
>> + * @regs:	pt_regs which contains kernel stack pointer.
>> + * @n:		stack entry number.
>> + *
>> + * regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which
>> + * is specified by @regs. If the @n th entry is NOT in the kernel stack,
>> + * this returns 0.
>> + */_
>> +unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n)
>> +{
>> +	unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs);
>> +
>> +	addr += n;
>> +	if (regs_within_kernel_stack(regs, (unsigned long)addr))
> If the @addr fall in the interrupt stack, the regs_within_kernel_stack()
> will return true. But Is it what we want?
>

Yes, I think it is.  The function is used in regs_get_kernel_stack_nth() 
to make sure the data being asked for (based on the pt_regs saved stack 
pointer) is actually on the stack, whether it's "kernel" stack or "irq" 
stack.

Thanks,
-dl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ