Coda File System

Re: venus dying with a SIGBUS

From: Jan Harkes <jaharkes_at_cs.cmu.edu>
Date: Wed, 27 Jun 2007 12:04:15 -0400
On Wed, Jun 27, 2007 at 09:47:46PM +0930, Brett Lymn wrote:
> OK - after more digging and debugging it looks like this may not be
> coda's fault, looking at the machine code level there looks like there
> may be a misaligned stack.  "let me get back to you on this" ;)

That is some good digging, but it may still be Coda's fault as we
allocate our own stacks for the LWP threads.

I think you can use 'print *lwp_cpptr' to see the current LWP thread
information block. That will contain the pointer to and the size of the
allocated stack space.

Either the stack is misaligned, or we didn't allocate enough space and
we overflowed. There is a chance that LWP actually makes sure that the
page below the stack is never allocated so that overflows would get
caught.

The stack allocation happens in LWP_CreateProcess, and I think we
typically use mmap to allocate them. It does look like we try to align
the stack size to a 4 byte value so technically the top of the stack
could be misaligned, but I think Coda only calls CreateProcess with
powers of 2 so most stacks should be 32, 64 or 128KB. So I would think
that a stack overflow is more likely the case.

To check if this happened you can compare the value of esp with the
lwp_cpptr->stack.ss_sp, if it is close or lower we probably have to
increase the stacksize for the thread.

Jan
Received on 2007-06-27 12:07:40