Re: [PATCH] i386 get_wchan() bugs (fs/proc/array.c)

Andrea Arcangeli (andrea@e-mind.com)
Tue, 15 Dec 1998 01:44:23 +0100 (CET)


On Thu, 10 Dec 1998, Jamie Lokier wrote:

>+ /* ebp isn't valid for newly created threads, but eip is. */
>+ eip = p->tss.eip;
>+ if (eip < first_sched || eip >= last_sched)
>+ return eip;

Right.

> stack_page = (unsigned long)p;
> esp = p->tss.esp;
>- if (!stack_page || esp < stack_page || esp >= 8188+stack_page)
>+ if (!stack_page || esp < stack_page || esp > 8188+stack_page)

Wrong. Dereferencing esp will not fault if it will be equal to
8188+stack_page.

> return 0;
> /* include/asm-i386/system.h:switch_to() pushes ebp last. */
> ebp = *(unsigned long *) esp;
> do {
>- if (ebp < stack_page || ebp >= 8188+stack_page)
>+ if (ebp < stack_page || ebp > 8184+stack_page)

Also here the check can be `ebp >= 8184+stack_page'.

Tell me if it' s too late to thing to these issues ;)

Andrea Arcangeli

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