On Dec 20, 12:26 pm, AJ ONeal <
coola...@gmail.com> wrote:
> Any ideas on what causes this error?
SIGBUS is caused by one of two things: Unaligned memory access or
access to an unmapped virtual address. Clearly your case must be the
latter, since memcpy does byte-aligned reads/writes. I've only seen
it happen when a file is mmap'd, then truncated, then an access is
made to the now-nonexistent portion of the file.
Your pseudocode doesn't show that you ever munmap and close outfile,
but I'm supposing you do. If you didn't, I suppose you might
eventually exhaust the virtual memory space -- but all of that space
should be unmapped as soon as the process terminates, so that wouldn't
explain the need to reboot.
This is very weird.
> How do I go about finding what #2 and #3 are?
There's another very weird thing. Those addresses are funny-looking.
One thing you can do is make sure you're liking to a libgcc that has
debugging symbols, so you can see all of the stack layers that run
before your code is called... but even without that, I'd expect to see
a main() on that stack before you get to frames without symbols. I'm
assuming that all of your code is built with debugging symbols.
The fact that a *reboot* is needed to clear the bad state really
points toward a kernel bug. It might be a good idea to ask on LKML (I
assume this is on Linux).
--
Shawn