[PATCH] Harden validate_sp against stack corruption

Milton Miller miltonm at bga.com
Sun Feb 25 04:57:24 EST 2007


On Mon Feb 19 11:42:42 EST 2007, Paul Mackerras wrote:

> If something has overflowed or corrupted the stack and causes an oops,
> and we try to print a stack trace, that will call validate_sp, which
> can itself cause an oops if the cpu field of the thread_info struct at
> the bottom of the stack has been corrupted (if CONFIG_IRQSTACKS is
> set).  This makes debugging harder.
>
> To avoid the second oops, this adds a check to make sure that the cpu
> number is reasonable before using it to check whether the stack is on
> the softirq or hardirq stack.
>
> Signed-off-by: Paul Mackerras <paulus at samba.org>
> ---
>
> diff --git a/arch/powerpc/kernel/process.c 
> b/arch/powerpc/kernel/process.c
> index f3d4dd5..3712fd5 100644
>


> +       if (cpu < NR_IRQS && cpu_possible(cpu)) {
>

NR_CPUS ?


(and I looked, its simple test_bit so its needed).

milton




More information about the Linuxppc-dev mailing list