[LCP]SIGBUS question
Bill Rausch
William.Rausch at numerical.com
Tue Apr 23 17:18:19 UTC 2002
You're using a switch statement on the pid? Looking for -1, 0, default?
Which process is getting the signal, the parent or the child? Or is fork()
failing and you're not checking for the -1?
Bill
At 11:44 PM +0200 4/19/02, Joachim Bauernberger wrote:
>Ok, After spending the evening with my best friend gdb I managed to
>pinpoint the location of the problem but have still no glue on what
>might be the cause :-((
>
>As soon as myfunc() calls fork, the process looses all it's information
>on previous stackframes. At this point I haven't even called exec()
>yet.
>
>Look here, those are the frames before calling fork (sorry if the lines
>wrap):
>
>(gdb) bt
>#0 local_inject (data=0xbfffa73c, rcpt=0x80d36b0
>"bj at bjdev.devel.gmx.net") at mda.c:198
>#1 0x8060398 in mknotify (what=665, who=2) at report.c:432
>#2 0x80504d9 in av_scan (entry=0xbfffb86c
>"/var/mxscan/scan//jbauernberger at gmx-ag.de-2002419232533-32132/1-base64-ZqKkai")
>at av_scan.c:50
>#3 0x804a5cc in b64decode (b64str=0x80d7de4, tnef=0, checksum=0x0) at
>b64decode.c:92
>#4 0x8050061 in mimeget (
> startpos=0x8071382 "\n\n\n", '-' <repeats 14 times>,
>"Boundary-00=_XXOTHOLISLOHA8DOE9Z7\nContent-Type: text/plain;\n
>charset=\"us-ascii\"\nContent-Transfer-Encoding: 8bit\nSubject:
>\n\n\n-- \nPGP Public
>Key:\nhttp://www.mXscan.org/pgp/public.html\n"...) at mimeget.c:292
>#5 0x804dfb3 in header (mref=0xbffffb1c) at header.c:729
>#6 0x8053b7c in main (argc=18, argv=0xbffffba4) at main.c:772
>#7 0x40119baf in __libc_start_main () from /lib/libc.so.6
>
>Now at line 210:
>(gdb) n
>210 switch ((pid = fork ())) {
>
>Immediately after fork the frame history is gone.
>(gdb) bt
>#0 local_inject (data=0xbfffa73c, rcpt=0x80d36b0
>"bj at bjdev.devel.gmx.net") at mda.c:210
>(gdb)
>
>That's it. The process then segfaults on return:
>(gdb) cont
>Continuing.
>Program received signal SIGSEGV, Segmentation fault.
>
>0x806059d in mknotify (what=Cannot access memory at address 0xfffffffe
>) at report.c:432
>432 rc = local_inject(¬ification, rcpt);
>
>
>Thanks,
>Joachim
>
>On Friday 19 April 2002 14:11, Joachim Bauernberger wrote:
>> Hi,
>> Can someone please take the time to explain to me what can cause a
>> SIGBUS to be raised by a program (other than mmap) under Linux?
>> I have been "googling" for answers and found that it's cause seems to
>be
>> architecture dependent?
>> (I've been able to catch it by setting up a signal handler but this
>> doesn't give much information other than it was indeed a SIGBUS that
>> crashed the program)
>>
>> Also raise()ing a SIGSTOP and then attaching to the process with gdb
>> shows me it's a SIGBUS but the information gdb gives me is not very
>> descriptive about why the problem occurs. It seems that on return from
>> myfunc() (which calls fork/exec and writes and reads with pipes
>to/from
>> the forked child) the programs memory gets corrupted.
>>
>> I started getting the problem after moving some code into myfunc() .
>> Now when the myfunc() returns the SIGBUS
>> results. Looking at gdb's output:
>>
>> Program received signal SIGBUS, Bus error.
>> mknotify (what=Cannot access memory at address 0xffffef36.
>> ) at report.c:450
>> 450 if (recipient) free(recipient);
>>
>> mknotify() is the function calling myfunc() and "what" is an int
>passed
>> to it as it's first parameter.
>>
>> This confuses me since I am not calling mknotify() any more upon
>return
>> >from myfunc() (before the sigbus).
>> Am I right to say that something in myfunc() corrupts the stack of my
>> program so badly that upon it's return the program does not know
>> anymore where to carry on?
>>
>> The system I have the problem is a linux libc5 box (i386) Kernel
>2.0.38
>> (don't tell me to upgrade please :-))
>>
>> Thanks & Regards,
>> Joachim
>>
>> --
>> PGP Public Key:
>> http://www.mXscan.org/pgp/public.html
>>
>>
>> _______________________________________________
>> This is the Linux C Programming List
>> : http://lists.linux.org.au/listinfo/linuxcprogramming List
> >
>>
>
>--
>PGP Public Key:
>http://www.mXscan.org/pgp/public.html
>
>
>_______________________________________________
>This is the Linux C Programming List
>: http://lists.linux.org.au/listinfo/linuxcprogramming List
--
Bill Rausch, Software Development, UNIX, Mac, Windows
Numerical Applications, Richland, WA 509-943-0861
More information about the linuxCprogramming
mailing list