On 06/29/2010 10:59 PM, Adam Jiang wrote:
I'm having a problem with kernel mode stack on my box. It seems that
STACKOVERFLOW happened to Linux kernel. However, I can't prove it
because the lack of any detection in __do_IRQ() function just like on
the other architectures. If you know something about, please help me
on following two questions.
- Is there any possible to do this on MIPS?
The mechanisms I know about for detecting stack overflow include:
1. Use of the MMU - stack ends at a page boundary, adjacent page is
either unmapped or mapped read-only and causes an exception if violated.
2. Hooks inserted into toolchain to cause any stack decrement to be
first tested against a limit.
3. Fill entire stack with a recognizable pattern before first
use. After suspected stack overflow, check to see if the pattern has
been disturbed in the area of the stack limit.
(Disclaimer: I've used all of these in some form on other OSes, but
not on Linux. Someone else may have a more directly relevant answer.)
- or, more simple question, how could I get the address $sp pointed by
asm() notation in C?
How about something like:
Any suggestion from you will be appreciated.
Phil Staub, Senior Member of Technical Staff, Wind River
Direct: 702.290.0470 Fax: 702.982.0085