[Xastir-Dev] Bus errors

Curt Mills, WE7U hacker at tc.fluke.com
Wed Nov 19 10:10:16 EST 2003


On Tue, 18 Nov 2003, Jack Twilley wrote:

> I've left xastir running for a while and after a day or so it exits
> with a bus error.
>
> I was able to generate a core the last time this happened, and the
> output was interesting.
>
> The bus error was at line 7098 in src/db.c in check_station_remove().
>
> That line is "if (p_station->sec_heard < t_rem) {".
> The bad memory access which caused the error was retrieving the value
> for p_station->sec_heard.  The value of p_station was 0xd0d0d0d0,
> which is very suspicious to me.
>
> Apparently FreeBSD's malloc overwrites free()'d memory with 0xd0 to
> prevent re-use.  This means there's a bug in our software somewhere.

Undoubtedly.  Bus Error is Mac-specific or perhaps FreeBSD or
Solaris, right?  I don't recall seeing that on an x86 platform
before.  As I recall, Bus Error means that you're out of word
alignment for memory accesses, meaning we bumped a pointer by an odd
number of bytes.

That can be caused either by a bad pointer (pointing to something
that has already been free'd) or by doing pointer arithmetic poorly.
Sounds like in this case it's the former.

-- 
Curt Mills, WE7U                    hacker_NO_SPAM_ at tc.fluke.com
Senior Methods Engineer/SysAdmin
"Lotto:    A tax on people who are bad at math!"
"Windows:  Microsoft's tax on computer illiterates!" -- WE7U
"The world DOES revolve around me:  I picked the coordinate system!"



More information about the Xastir-dev mailing list