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]
Date:	Thu, 21 Jul 2016 23:08:40 -0400
From:	Brian Gerst <brgerst@...il.com>
To:	Josh Poimboeuf <jpoimboe@...hat.com>
Cc:	Andy Lutomirski <luto@...capital.net>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...nel.org>,
	"H . Peter Anvin" <hpa@...or.com>, X86 ML <x86@...nel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Kees Cook <keescook@...omium.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Byungchul Park <byungchul.park@....com>
Subject: Re: [PATCH 03/19] x86/dumpstack: remove unnecessary stack pointer arguments

On Thu, Jul 21, 2016 at 9:41 PM, Josh Poimboeuf <jpoimboe@...hat.com> wrote:
> On Thu, Jul 21, 2016 at 02:56:52PM -0700, Andy Lutomirski wrote:
>> On Thu, Jul 21, 2016 at 2:21 PM, Josh Poimboeuf <jpoimboe@...hat.com> wrote:
>> > When calling show_stack_log_lvl() or dump_trace() with a regs argument,
>> > providing a stack pointer or frame pointer is redundant.
>> >
>>
>> > diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
>> > index 358fe1c..c533b8b 100644
>> > --- a/arch/x86/kernel/dumpstack_32.c
>> > +++ b/arch/x86/kernel/dumpstack_32.c
>> > @@ -122,7 +122,7 @@ void show_regs(struct pt_regs *regs)
>> >                 u8 *ip;
>> >
>> >                 pr_emerg("Stack:\n");
>> > -               show_stack_log_lvl(NULL, regs, &regs->sp, 0, KERN_EMERG);
>> > +               show_stack_log_lvl(NULL, regs, NULL, 0, KERN_EMERG);
>>
>> This is weird -- note the &.  You're at some risk of exposing a bug in
>> x86_32's kernel_stack_pointer() function, which is a mess.  (I don't
>> see why it's written the way it is -- the actual return stack pointer
>> given a pt_regs is quite well defined -- if regs->cs & 3 != 0, then
>> it's regs->sp, else it's &regs->sp.)
>>
>> That being said, this isn't a big deal, so:
>>
>> Reviewed-by: Andy Lutomirski <luto@...nel.org>
>>
>> If you want to make this all a bit more reliably on x86_32, you could
>> fix kernel_stack_pointer().
>
> Ok.  The whole '&regs->sp' thing threw me for a loop.  I have no idea
> what kernel_stack_pointer() is trying to do.  I just assumed it was
> correct.  I'll take a look at it and try to fix it in another patch.

On 32-bit, when an interrupt doesn't change CPL, SS:ESP is not pushed.
So, effectively, the old stack pointer is &regs->sp.

--
Brian Gerst

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ