[Top] [All Lists]

Re: How to detect STACKOVEFLOW on mips

To: Ralf Baechle <>
Subject: Re: How to detect STACKOVEFLOW on mips
From: Matt Fleming <>
Date: Wed, 30 Jun 2010 22:57:41 +0100
Cc:, Adam Jiang <>
In-reply-to: <>
References: <> <>
User-agent: Notmuch/0.3.1-61-g3f63bb6 ( Emacs/ (x86_64-unknown-linux-gnu)
On Wed, 30 Jun 2010 15:50:06 +0100, Ralf Baechle <> wrote:
> There used to be some code for other architectures that zeros the stack
> page and counts how much of that has been overwritten by the stack.  That
> was never ported to MIPS.
> Another helper to find functions that do excessive static allocations is
> "make checkstack".

Both SH and sparc use the mcount function (enabled with the -pg switch
to gcc) to check the stack has not overflowed. The relevant code is in
arch/{sh,sparc}/lib/mcount.S. This checks the stack pointer value on
every function call. Yeah, it's heavy-weight, but an implementation for
MIPS should be able to catch almost the exact point at which stack
overflow occurs.

<Prev in Thread] Current Thread [Next in Thread>