SMP: BUG() on cat /proc/$PID/stack

Rabin Vincent rabin at rab.in
Thu Jan 13 13:54:19 EST 2011


On SMP, this BUG() in save_stack_trace_tsk() can be easily triggered
from user space by reading /proc/$PID/stack, where $PID is any pid but
the current process:

        if (tsk != current) {
#ifdef CONFIG_SMP
                /*
                 * What guarantees do we have here that 'tsk'
                 * is not running on another CPU?
                 */
                BUG();
#else

x86 appears to go ahead in this case, but has its stack walking code
check at every step that the stack pointer it's reading from is valid --
is this what is needed in the ARM unwind code to get rid of this BUG()?

Also, get_wchan() does similar stack walking but there it just checks
for task->state != TASK_RUNNING before.  Is that a sufficient check
there?



More information about the linux-arm-kernel mailing list