public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Query] Stack Overflow in "arch/arm/kernel/unwind.c" while unwinding frame
@ 2013-09-24  5:23 Anurag Aggarwal
  2013-09-24  6:28 ` Jean Pihet
  0 siblings, 1 reply; 5+ messages in thread
From: Anurag Aggarwal @ 2013-09-24  5:23 UTC (permalink / raw)
  To: linux-kernel

Hi All,

While executing unwind backtrace instructions in ARM, in the function
unwind_exec_insn()
there are chances that SP overflows from stack.


For example while executing instruction with opcode 0xAE, vsp can go
beyond stack to area that has not been allocated till now.

unsigned long *vsp = (unsigned long *)ctrl->vrs[SP];
int reg;

/* pop R4-R[4+bbb] */
for (reg = 4; reg <= 4 + (insn & 7); reg++)
ctrl->vrs[reg] = *vsp++;

The above scenario can happen while executing any of the unwind instruction.

One of the ways to fix the problem is to check for vsp with stack
limits before we increment it, but doing it for all the instructions
seems a little bad.

I just want to know that if anyone has faced the problem before

I am working on Linux kernel for Android phones and I saw one case
when this happened.

I am new to Linux Kernel so not sure if this is the right place to ask
the question.


-- 
Anurag Aggarwal

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-10-06  7:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-24  5:23 [Query] Stack Overflow in "arch/arm/kernel/unwind.c" while unwinding frame Anurag Aggarwal
2013-09-24  6:28 ` Jean Pihet
2013-09-24  6:29   ` Anurag Aggarwal
2013-10-02 18:11   ` Catalin Marinas
2013-10-06  7:14     ` Anurag Aggarwal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox