2009-09-24 02:14:24 mj2000 in bf561
xiyao liu (CHINA)
Message: 80330
我使用bf561内核中使用uclinux交叉编译器bfin-uclinux-gcc对mjepg2000的开源库形成的mjpeg2000可执行文件mj2_to_mj2 进行编译,出现如下错误:
root:/mj2000> ./mj2_to_mj2 -i huo.mj2 -o blue.mj2
NULL pointer access (probably)
Defered Exception context
CURRENT PROCESS:
COMM=mj2_to_mj2 PID=98
TEXT = 0x00240040-0x00266d00 DATA = 0x00266d04-0x0026e8c4
BSS = 0x0026e8c4-0x00271b94 USER-STACK = 0x00272f50
return address: [0x002625fe]; contents of:
0x002625d0: a109 55c1 0c07 1164 0000 0000 9148 e14a
0x002625e0: 0026 9940 6151 e10a e884 0808 6006 6003
0x002625f0: 9154 1835 0000 3268 9969 3219 5c9c [9510]
0x00262600: 4818 183d 6801 e12a 0ffe 0951 1405 3219
SEQUENCER STATUS: Not tainted
SEQSTAT: 00060027 IPEND: 0030 SYSCFG: 0006
HWERRCAUSE: 0x18
EXCAUSE : 0x27
RETE: <0x00000000> /* Maybe null pointer? */
RETN: <0x00212000> /* unknown address */
RETX: <0x002625fe> [ mj2_to_mj2 + 0x225be ]
RETS: <0x00262400> [ mj2_to_mj2 + 0x223c0 ]
PC : <0x002625fe> [ mj2_to_mj2 + 0x225be ]
DCPLB_FAULT_ADDR: <0x000000e6> /* Maybe null pointer? */
ICPLB_FAULT_ADDR: <0x002625fe> [ mj2_to_mj2 + 0x225be ]
PROCESSOR STATE:
R0 : 00000073 R1 : 00000073 R2 : 00000000 R3 : 00000000
R4 : 00000000 R5 : 00268228 R6 : 00000000 R7 : 00000000
P0 : 00267b71 P1 : 00268228 P2 : 000000e6 P3 : 00000073
P4 : 00000000 P5 : 00267b71 FP : 002681c4 SP : 00211f24
LB0: 0026324d LT0: 0026324c LC0: 00000000
LB1: 002623cd LT1: 002623cc LC1: 00000000
B0 : 00000000 L0 : 00000000 M0 : 00000000 I0 : 0026c8f0
B1 : 00000000 L1 : 00000000 M1 : 00000000 I1 : 001e78e0
B2 : 00000000 L2 : 00000000 M2 : 00000000 I2 : 00000000
B3 : 00000000 L3 : 00000000 M3 : 00000000 I3 : 00000000
A0.w: 00000000 A0.x: 00000000 A1.w: 00000000 A1.x: 00000000
USP : 00268178 ASTAT: 02003004
Hardware Trace:
0 Target : <0x00004938> { _trap_c + 0x0 }
Source : <0xffa00764> { _exception_to_level5 + 0xb4 }
1 Target : <0xffa006b0> { _exception_to_level5 + 0x0 }
Source : <0xffa0060c> { _ex_trap_c + 0x5c }
2 Target : <0xffa005b0> { _ex_trap_c + 0x0 }
Source : <0xffa0044a> { _ex_workaround_261 + 0x22 }
3 Target : <0xffa00428> { _ex_workaround_261 + 0x0 }
Source : <0xffa00804> { _trap + 0x28 }
4 Target : <0xffa007dc> { _trap + 0x0 }
Source : <0x002625fc> [ mj2_to_mj2 + 0x225bc ]
5 Target : <0x002625b0> [ mj2_to_mj2 + 0x22570 ]
Source : <0x002623fc> [ mj2_to_mj2 + 0x223bc ]
6 Target : <0x002623f0> [ mj2_to_mj2 + 0x223b0 ]
Source : <0x002623da> [ mj2_to_mj2 + 0x2239a ]
7 Target : <0x002623b8> [ mj2_to_mj2 + 0x22378 ]
Source : <0x00263252> [ mj2_to_mj2 + 0x23212 ]
8 Target : <0x00263224> [ mj2_to_mj2 + 0x231e4 ]
Source : <0x002623b4> [ mj2_to_mj2 + 0x22374 ]
9 Target : <0x002623a4> [ mj2_to_mj2 + 0x22364 ]
Source : <0x00261eaa> [ mj2_to_mj2 + 0x21e6a ]
10 Target : <0x00261ea0> [ mj2_to_mj2 + 0x21e60 ]
Source : <0x00261e92> [ mj2_to_mj2 + 0x21e52 ]
11 Target : <0x00261e70> [ mj2_to_mj2 + 0x21e30 ]
Source : <0x0026184c> [ mj2_to_mj2 + 0x2180c ]
12 Target : <0x0026182a> [ mj2_to_mj2 + 0x217ea ]
Source : <0x00263210> [ mj2_to_mj2 + 0x231d0 ]
13 Target : <0x002631d8> [ mj2_to_mj2 + 0x23198 ]
Source : <0x00261cf2> [ mj2_to_mj2 + 0x21cb2 ]
14 Target : <0x00261ce0> [ mj2_to_mj2 + 0x21ca0 ]
Source : <0x00261826> [ mj2_to_mj2 + 0x217e6 ]
15 Target : <0x002617fc> [ mj2_to_mj2 + 0x217bc ]
Source : <0x002617f2> [ mj2_to_mj2 + 0x217b2 ]
Stack from 00211f04:
00000000 ffa00768 00136568 00136568 00136568 04000021 00000000 00264554
002625fe 00000030 00060027 00000000 00212000 002625fe 002625fe 00262400
00000073 02003004 002623cd 0026324d 002623cc 0026324c 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 001e78e0 0026c8f0 00268178 002681c4 00267b71 00000000
Call Trace:
SIGSEGV
其中mjepg同样的库在gcc编译的可执行文件mj2_to_mj2用同样 ./mj2_to_mj2 -i huo.mj2 -o blue.mj2命令在gcc编译下可以成功运行。
请问有人知道SIGSEGV怎么解决么?谢谢
mj200.txt
TranslateQuoteReplyEditDelete
2009-09-24 10:24:50 Re: mj2000 in bf561
Robin Getz (UNITED STATES)
Message: 80385
Xiyao:
https://docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:analyzing_traces
QuoteReplyEditDelete
2009-09-25 05:01:12 Re: mj2000 in bf561
xiyao liu (CHINA)
Message: 80446
Robin Getz:
thanks!
我按照你上面提到的文档调试了我的程序,调试结果显示,错误出现在下面函数:
/libc/stdio/vsnprintf.c
在网上找了一下这个函数的说明好像使用这个函数容易出现安全隐患,我们删除了程序中用到这个函数的相关部分,可是还是出现那样的错误
我现在使用的内核版本为:uclinux-dist-2008R1.5-RC3, toolchain 版本为:blackfin-toolchain-08r1.5-14.i386 blackfin-toolchain-uclibc-full-08r1.5-14.i386 ,想问一下会不是是我用的交叉编译器的问题,是不是这个交叉编译器存在有bug呢?
谢谢
TranslateQuoteReplyEditDelete
2009-09-25 13:27:56 Re: mj2000 in bf561
Mike Frysinger (UNITED STATES)
Message: 80454
most likely the error isnt in vsnprintf.c but rather your code that is calling that. if you pass bad pointers to the C library, then it will crash in there, but it's still the fault of the program.