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 [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/