From: Dave Butenhof <David.Butenhof@compaq.com>
Subject: Re: SEGFAULT on Tru64
Date: Fri, 08 Sep 2000 06:58:00 -0400 [thread overview]
Message-ID: <39B8C638.FD9F5EF3@compaq.com> (raw)
In-Reply-To: 39B8A896.6156719F@msa.dec.com
Wai-Sun Chia wrote:
> Here's a dbx/ladebug trace on my multithreaded server which always
> segfaults within 10 minutes of run:
>
> This is on a Tru64 4.0f system.
>
> [cmd]$ ladebug cmd core
> Welcome to the Ladebug Debugger Version 4.0-62 (built Jun 2 2000)
> ------------------
> object file name: cmd
> core file name: core
> Reading symbolic information ...done
> Core file produced from executable 'cmd'
> Thread 0x3eb2 terminated at PC 0xa805c0f90 by signal SEGV
> (ladebug) where
> >0 0xa805c0f90
You've almost certainly corrupted your stack. With so little information, I
can only do so much random guessing about how you might have done it, but
I can offer a few tips. The places to start looking are writing through an
uninitialized pointer, using out of scope shared data, (especially when one
thread tries to share data on another thread's stack), or a misunderstanding
of some API. The possibilities, unfortunately, are almost endless.
Specifically, (though this may not help you much), you've very likely
overwritten the saved RA (r26) of a stack frame, sending the thread into
"hyperspace" when that frame tries to return. A great way to do this is to
write (or cause an API to write) into a short data type via a pointer that
was cast as if it pointed to a larger type. I used to see this a lot by
people who tried to return the "void*" value of a pthread_join into an "int
value", for example, carefully casting "&value" (pointer to a 32-bit value)
to "(void**)&value" (pointer to a 64-bit value) to keep the compiler from
complaining. This can easily happen a lot in code that was originally written
using some of the bad assumptions people learn on 32-bit systems, but is less
likely from people with some awareness of 64-bit programming. (Which is
probably why I haven't seen this one for a long time.)
/------------------[ David.Butenhof@compaq.com ]------------------\
| Compaq Computer Corporation http://members.aol.com/drbutenhof |
| 110 Spit Brook Rd ZKO2-3/Q18, Nashua NH 03062-2698 |
\--------[ http://www.awl.com/cseng/titles/0-201-63392-2/ ]-------/
prev parent reply other threads:[~2000-09-08 10:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-09-08 8:51 SEGFAULT on Tru64 Wai-Sun Chia
2000-09-08 10:58 ` Dave Butenhof [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox