Messages in this thread | | | Date | Mon, 04 Oct 2004 13:28:01 +0400 | From | Oleg Nesterov <> | Subject | Re: [PATCH] alternate stack dump fix. |
| |
Andrew Morton wrote: > > In that case I'm not understanding you. Are you saying that your patch > fixes the same problem as that which Kirill's patch fixed?
It seems to me, yes.
Here the pseudo code for CONFIG_FRAME_POINTER:
int valid_stack_ptr(struct thread_info *tinfo, void *p) { return p > (void *)tinfo && p < (void *)tinfo + THREAD_SIZE - 3; }
long print_context_stack(thread_info *tinfo, long *stack, long ebp) { while (valid_stack_ptr(tinfo, ebp)) { print_symbol("%s", *(ebp+4)); ebp = *(unsigned long *)ebp; }
return ebp; }
void show_trace(struct task_struct *task, unsigned long * stack) { while (1) { struct thread_info *context = (struct thread_info *) ((unsigned long)stack & (~(THREAD_SIZE - 1)));
ebp = print_context_stack(context, stack, ebp);
stack = (unsigned long*)context->previous_esp; if (!stack) break; printk(" =======================\n"); } }
show_trace() now does not use task argument in the main loop. Instead, it converts stack to thread_info* context, and passes it to print_context_stack() and (implicitly) to valid_stack_ptr().
valid_stack_ptr() does not care now whether or not it is irq stack, it just does bounds checking.
Please note, i simply deleted this printk("Stack pointer is garbage"), it can be restored, if neccessary.
Did i miss something?
> That wasn't at all clear from your earlier comments.
Yes, sorry.
Oleg. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |