Reason of segmentation violation cause in system call

w.n. jacobs willy.jacobs at nl.thalesgroup.com
Wed Sep 10 22:24:42 EST 2003


I've a multi-threading application which crashes sometimes the application on a
read(). The read() is done on a TCP stream socket. Linux is 2.4.4 (denx).
This is the post mortem dump of gdb:

GNU gdb 5.1.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "ppc-linux"...

warning: core file may not match specified executable file.
Core was generated by `/bin/liwf_mpip'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld.so.1...done.
Loaded symbols for /lib/ld.so.1
#0  0x0ff7c2e8 in read () from /lib/libc.so.6
(gdb) bt
#0  0x0ff7c2e8 in read () from /lib/libc.so.6
#1  0x10009ce8 in read (fd=8, buf=0x7f5fef08, count=12) at wrapsyscall.c:153
#2  0x10004324 in liwf_receive_process_data (arg=0x8) at liwf_mpip_main.c:281
#3  0x10004f1c in pthread_start_thread (arg=0x200) at manager.c:291
#4  0x0ff899d0 in clone () from /lib/libc.so.6
(gdb) info reg
r0             0x3      3
r1             0x7f5feed0       2136993488
r2             0xc03f8000       -1069580288
r3             0x200    512
r4             0x7f5fef08       2136993544
r5             0xc      12
r6             0x10     16
r7             0x7f5feee8       2136993512
r8             0x0      0
r9             0x7f5fffff       2136997887
r10            0x0      0
r11            0x7f5feec0       2136993472
r12            0x20444082       541343874
r13            0x1002b610       268613136
r14            0x7fdf000        134082560
r15            0x0      0
r16            0x10020c30       268569648
r17            0x10020d8c       268569996
r18            0x0      0
r19            0x8      8
r20            0x100042e8       268452584
r21            0x1002d41c       268620828
r22            0x24     36
r23            0x10020000       268566528
r24            0x10020000       268566528
r25            0x1000   4096
r26            0x30     48
r27            0x8      8
r28            0x7f5fef08       2136993544
r29            0xc      12
r30            0x7f5ff508       2136995080
r31            0x7f5fef08       2136993544
pc             0xff7c2e8        267895528
ps             0xd932   55602
cr             0x30444082       809779330
lr             0x10009ce8       268475624
ctr            0x0      0
xer            0x20000000       536870912
(gdb) disass
Dump of assembler code for function read:
0xff7c2e0 <read>:       li      r0,3
0xff7c2e4 <read+4>:     sc
0xff7c2e8 <read+8>:     bnslr				<====== crash location
0xff7c2ec <read+12>:    b       0xfed000c <__libc_start_main+524>
End of assembler dump.

r3 value is incorrect? (should be 8 on entry, but will also contain the return
value if the system call), r4 is the buffer address (is ok), and r5 is requested
buffer length.

So what is the exact reason of the crash?
--
willy


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-embedded mailing list