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: <1188581852.10802.13.camel@localhost.localdomain>
Date:	Sat, 01 Sep 2007 03:37:32 +1000
From:	Rusty Russell <rusty@...tcorp.com.au>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, lguest <lguest@...abs.org>,
	Frederik Deweerdt <deweerdt@...e.fr>, Andi Kleen <ak@....de>
Subject: Re: [PATCH] Fix out-by-one error in traps.c

On Fri, 2007-08-31 at 00:51 -0700, Linus Torvalds wrote:
> 
> On Fri, 31 Aug 2007, Rusty Russell wrote:
> > head.S pushes a "$0" on the stack to stop the unwinder, lguest doesn't.
> 
> The unwinder should stop when it sees an invalid frame pointer, and even 
> without the push 0 I'd have expected it to be invalid.
> 
> But I suspect lguest triggers another thing: you actually make the stack 
> start at the *very*top* of the stack area. Afaik, normal x86 does not. A 
> normal x86 kernel will start off with a pt_regs[] setup, I think - ie the 
> kernel stack is always set up so that it has the "return to user mode" 
> information.

This is only for the initial booting stack (init_thread_union); see
arch/i386/kernel/head.S:
	/* Set up the stack pointer */
	lss stack_start,%esp
	...
	pushl $0		# fake return address for unwinder
	...
.data
ENTRY(stack_start)
	.long init_thread_union+THREAD_SIZE
	.long __BOOT_DS

lguest_asm.S missed the pushl $0 (lguest doesn't boot via head.S.  I'd
like to change that for 2.6.24, but it involved perturbing that code so
maybe not).

> But your patch does improve the sanity checking of the frame pointer. That 
> said, I think the following patch improves it more: does this also work 
> for you? (Totally untested, but it looks like the RightThing(tm) to do)

Yes, looks good.  Perhaps one additional magic num removal:

>  #ifdef	CONFIG_FRAME_POINTER
> -	while (valid_stack_ptr(tinfo, (void *)ebp)) {
> +	while (valid_stack_ptr(tinfo, (void *)ebp, 2*sizeof(unsigned long))) {
>  		unsigned long new_ebp;
>  		addr = *(unsigned long *)(ebp + 4);

*((unsigned long *)ebp + 1)?

Thanks,
Rusty.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ