2009-08-27 08:22:08 ftpd crash
billy zhou (UNITED STATES)
Message: 79302
I use the lastest 2009R1-release
when I use the filezilla as the ftpclient to download files from the board, the error message come out:
it looks like similar as the blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=659, but it not give the result with the problem.
what can I do to deal with the error?
Illegal use of supervisor resource
- Attempted to use a Supervisor register or instruction from User mode.
Supervisor resources are registers and instructions that are reserved
for Supervisor use: Supervisor only registers, all MMRs, and Supervisor
only instructions.
Deferred Exception context
CURRENT PROCESS:
COMM=ftpd PID=297
CPU = 0
TEXT = 0x00dc0040-0x00dd1300 DATA = 0x00dd1320-0x00dd61a0
BSS = 0x00dd61a0-0x00de8410 USER-STACK = 0x00deaf34
return address: [0x00dccfb2]; contents of:
0x00dccf90: e3ff fa8c 934a 2f89 9317 2fa4 3200 a000
0x00dccfa0: 0140 ac41 ac82 acc3 ad04 ad45 ad87 9030
0x00dccfb0: adc6 [0140] 0141 a200 a241 a282 a2c3 a304
0x00dccfc0: a345 a386 a3c7 e400 0010 3830 e400 0011
ADSP-BF531-0.5 378(MHz CCLK) 63(MHz SCLK) (mpu off)
Linux version 2.6.28.10-ADI-2009R1
Built with gcc version 4.1.2 (ADI svn)
SEQUENCER STATUS: Not tainted
SEQSTAT: 0006002e IPEND: 0030 SYSCFG: 0006
EXCAUSE : 0x2e
interrupts disabled
physical IVG5 asserted : <0xffa08bc4> { _evt_ivhw + 0x0 }
RETE: <0x00000000> /* Maybe null pointer? */
RETN: <0x01416000> /* kernel dynamic memory */
RETX: <0x00000480> /* Maybe fixed code section */
RETS: <0x00dc6adc> [ ftpd + 0x6a9c ]
PC : <0x00dccfb2> [ ftpd + 0xcf72 ]
DCPLB_FAULT_ADDR: <0xfffffffc> /* kernel dynamic memory */
ICPLB_FAULT_ADDR: <0x00dccfb2> [ ftpd + 0xcf72 ]
PROCESSOR STATE:
R0 : 32040020 R1 : 00000001 R2 : 00000000 R3 : 00000008
R4 : 00dd1650 R5 : 00000001 R6 : 00000002 R7 : 00000001
P0 : 00de81e0 P1 : 30393030 P2 : 00343238 P3 : 00deaf38
P4 : 00672104 P5 : 00000000 FP : 7fffffff SP : 01415f24
LB0: 00dca6d3 LT0: 00dca6d2 LC0: 00000000
LB1: 00dc9845 LT1: 00dc9844 LC1: 00000000
B0 : 00dea69c L0 : 00000000 M0 : 0000000c I0 : 00dea6b0
B1 : 00dea698 L1 : 00000000 M1 : 00000000 I1 : 00dd5e98
B2 : 00000000 L2 : 00000000 M2 : 00000000 I2 : 67452301
B3 : 00000000 L3 : 00000000 M3 : 00000000 I3 : 00dea6a0
A0.w: 0000000a A0.x: 00000000 A1.w: 0000000a A1.x: 00000000
USP : 00000000 ASTAT: 02001025
Hardware Trace:
0 Target : <0x00004c18> { _trap_c + 0x0 }
Source : <0xffa0860a> { _exception_to_level5 + 0x9e } CALL pcrel
1 Target : <0xffa0856c> { _exception_to_level5 + 0x0 }
Source : <0xffa0844c> { _bfin_return_from_exception + 0x18 } RTX
2 Target : <0xffa08434> { _bfin_return_from_exception + 0x0 }
Source : <0xffa084c2> { _ex_trap_c + 0x46 } JUMP.S
3 Target : <0xffa0847c> { _ex_trap_c + 0x0 }
Source : <0xffa086e2> { _trap + 0x66 } JUMP (P4)
4 Target : <0xffa0869c> { _trap + 0x20 }
Source : <0xffa08698> { _trap + 0x1c } IF !CC JUMP
5 Target : <0xffa0867c> { _trap + 0x0 }
Source : <0x00dccfb0> [ ftpd + 0xcf70 ] 0xadc6
6 Target : <0x00dccf9c> [ ftpd + 0xcf5c ]
Source : <0x00dc6ad8> [ ftpd + 0x6a98 ] CALL pcrel
7 Target : <0x00dc6abc> [ ftpd + 0x6a7c ]
Source : <0x00dc0d8a> [ ftpd + 0xd4a ] CALL pcrel
8 Target : <0x00dc0d74> [ ftpd + 0xd34 ]
Source : <0x00dc2452> [ ftpd + 0x2412 ] RTS
9 Target : <0x00dc244c> [ ftpd + 0x240c ]
Source : <0x00dc7ddc> [ ftpd + 0x7d9c ] RTS
10 Target : <0x00dc7dd8> [ ftpd + 0x7d98 ]
Source : <0x00dc7b82> [ ftpd + 0x7b42 ] RTS
11 Target : <0x00dc7b7c> [ ftpd + 0x7b3c ]
Source : <0x00dcb788> [ ftpd + 0xb748 ] RTS
12 Target : <0x00dcb780> [ ftpd + 0xb740 ]
Source : <0x00dcb750> [ ftpd + 0xb710 ] IF !CC JUMP
13 Target : <0x00dcb74c> [ ftpd + 0xb70c ]
Source : <0x00dcd084> [ ftpd + 0xd044 ] RTS
14 Target : <0x00dcd072> [ ftpd + 0xd032 ]
Source : <0xffa08bc2> { __common_int_entry + 0xda } RTI
15 Target : <0xffa08b60> { __common_int_entry + 0x78 }
Source : <0xffa08e84> { _evt_system_call + 0x64 } JUMP.S
Userspace Stack
Stack info:
SP: [0x01415e74] <0x01415e74> /* kernel dynamic memory */
FP: (0x01415ea4)
Memory from 0x01415e70 to 01416000
01415e70: 00dea698 [01415e74] ffffffff 00000029 00000000 00030005 00000000 00000000
01415e90: 00000000 0000000c 00dea6a0 67452301 00dea255 (00000000)<0003f324><0001a23e>
01415eb0: 0001a1f0 000000ae 00000000 01415ee4 00dea174 0000000d 01415ef0 <0003f5f4>
01415ed0: 01593340 00dea22c 00000029 000003e0 00000080 00dc2298 10000000 00deaf38
01415ef0: 00001000 00000000 <ffa08818><ffa0860e> ffa08bc4 ffe02014 00000001 0000ffff
01415f10: 00000001 00dd1650 00000008 00dea62b 00dcd072 00000480 00000030 0006002e
01415f30: 00000000 01416000 00000480 00dccfb2 <00dc6adc> 32040020 02001025 00dc9845
01415f50: 00dca6d3 00dc9844 00dca6d2 00000000 00000000 0000000a 00000000 0000000a
01415f70: 00000000 00000000 00000000 00dea698 00dea69c 00000000 00000000 00000000
01415f90: 00000000 00000000 00000000 00000000 0000000c 00dea6a0 67452301 00dd5e98
01415fb0: 00dea6b0 00000000 7fffffff 00000000 00672104 00deaf38 00343238 30393030
01415fd0: 00de81e0 00000001 00000002 00000001 00dd1650 00000008 00000000 00000001
01415ff0: 32040020 32040020 00de81e0 00000006 5555d554
Return addresses in stack:
frame 1 : <0x0003f324> { _vfs_write + 0x94 }
address : <0x0001a23e> { _sys_rt_sigaction + 0x4e }
address : <0x0003f5f4> { _sys_write + 0x30 }
address : <0xffa08818> { _system_call + 0x68 }
address : <0xffa0860e> { _exception_to_level5 + 0xa2 }
address : <0x00dc6adc> [ ftpd + 0x6a9c ]
QuoteReplyEditDelete
2009-08-27 14:41:10 Re: ftpd crash
Robin Getz (UNITED STATES)
Message: 79314
Billy:
Since the USP is zero - looks like stack corruption. Read and follow the debugging at:
https://docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:debugging_applications#stack_checking
-Robin
QuoteReplyEditDelete
2009-08-27 22:08:58 Re: ftpd crash
Barry Song (CHINA)
Message: 79329
Billy,
can you provide more details about your build config and options and how to repeat it ? I'd like to creat a bug trace item after making sure.
-Barry
QuoteReplyEditDelete
2009-08-27 22:59:03 Re: ftpd crash
billy zhou (UNITED STATES)
Message: 79331
to Barry:
use the filezilla to upload some small files, then download them, it's better to upload hundreds files to repeat it
to Robin:
I tried the method, but as a result, the filezilla can't connect to my board, and can't download files...
QuoteReplyEditDelete
2009-08-28 17:02:21 Re: ftpd crash
Chris Brissette (UNITED STATES)
Message: 79368
We had problems with FTPD, what we traced it down to was when the ls command is issued it uses the stack to move the response. If the responce was larger then the stack, it would overflow. We fixed by increasing the stack to 16k in the build. (of course this would crash at some point to.) I can't remember the details. And I might be off base, but if you are having troubles with opening directories with alot of files this could be the problem.
Chris
QuoteReplyEditDelete
2009-08-30 03:07:01 Re: ftpd crash
billy zhou (UNITED STATES)
Message: 79384
thanks to Chris, follow your advise, I fixed the problem by increasing the stack to 16k in the build, thanks a lot!
QuoteReplyEditDelete
2009-08-31 13:26:36 Re: ftpd crash
Robin Getz (UNITED STATES)
Message: 79414
This seems like a hoky workaround.
It would be better to malloc/free things - than stuff huge/dynamic things on the stack.. from system().
-Robin
QuoteReplyEditDelete
2009-09-03 03:26:07 Re: ftpd crash
Peter Gombos (HUNGARY)
Message: 79510
I have a similar problem but increasing the stack size was uneffective.
If I use a simple command-line ftp client with the basic commands (cd, ls, get, put) everything is OK. But the midnight commander built-in client. causes an exeption like this:
Sep 3 07:15:54 blackfin ftp.info ftpd[172]: connection from 192.168.1.20
Sep 3 07:15:59 blackfin ftp.info ftpd[172]: FTP LOGIN FROM 192.168.1.20 as root
Sep 3 07:15:59 blackfin user.notice kernel: NULL pointer access
Sep 3 07:15:59 blackfin user.notice kernel: Deferred Exception context
Sep 3 07:15:59 blackfin user.notice kernel: CURRENT PROCESS:
Sep 3 07:15:59 blackfin user.notice kernel: COMM=ftpd PID=172
Sep 3 07:15:59 blackfin user.notice kernel: CPU = 0
Sep 3 07:15:59 blackfin user.notice kernel: TEXT = 0x00700040-0x00710b20 DATA = 0x00710b40-0x00715964
Sep 3 07:15:59 blackfin user.notice kernel: BSS = 0x00715964-0x00727bc0 USER-STACK = 0x00729f34
Sep 3 07:15:59 blackfin user.notice kernel: return address: [0x0070b70a]; contents of:
Sep 3 07:15:59 blackfin user.notice kernel: 0x0070b6e0: 67e7 e140 0071 300f e100 57dc e300 01a0
Sep 3 07:15:59 blackfin user.notice kernel: 0x0070b6f0: 3228 e14b 0070 e140 0071 e100 57e0 e10b
Sep 3 07:15:59 blackfin user.notice kernel: 0x0070b700: cb88 0063 0c45 180a b9f0 [9228] 0c45 183d
Sep 3 07:15:59 blackfin user.notice kernel: P0 : 000000c0 P1 : 00729648 P2 : 00715874 P3 : 0070cb88
Sep 3 07:15:59 blackfin user.notice kernel: P4 : 0070cb88 P5 : 00000014 FP : 00728460 SP : 037abf24
Sep 3 07:15:59 blackfin user.notice kernel: LB0: 0070a67f LT0: 0070a66c LC0: ffffffff
Sep 3 07:15:59 blackfin user.notice kernel: LB1: 00709701 LT1: 00709700 LC1: 00000000
Sep 3 07:15:59 blackfin user.notice kernel: B0 : 0072969c L0 : 00000000 M0 : 0000000c I0 : 007d304c
Sep 3 07:15:59 blackfin user.notice kernel: B1 : 00729698 L1 : 00000000 M1 : 00000000 I1 : 0071568c
Sep 3 07:15:59 blackfin user.notice kernel: B2 : 00000000 L2 : 00000000 M2 : 00000000 I2 : 67452301
Sep 3 07:15:59 blackfin user.notice kernel: B3 : 00000000 L3 : 00000000 M3 : 00000000 I3 : 007296a0
Sep 3 07:15:59 blackfin user.notice kernel: A0.w: 00000001 A0.x: 00000000 A1.w: 00000001 A1.x: 00000000
Sep 3 07:15:59 blackfin user.notice kernel: USP : 00728444 ASTAT: 02002000
Sep 3 07:15:59 blackfin user.notice kernel: Hardware Trace:
Sep 3 07:15:59 blackfin user.notice kernel: 0 Target : <0x00004ca8> { _trap_c + 0x0 }
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0xffa00696> { _exception_to_level5 + 0xae }
Sep 3 07:15:59 blackfin user.notice kernel: 1 Target : <0xffa005e8> { _exception_to_level5 + 0x0 }
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0xffa004a4> { _bfin_return_from_exception + 0x20 }
Sep 3 07:15:59 blackfin user.notice kernel: 2 Target : <0xffa00484> { _bfin_return_from_exception + 0x0 }
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0xffa00540> { _ex_trap_c + 0x6c }
Sep 3 07:15:59 blackfin user.notice kernel: 3 Target : <0xffa004d4> { _ex_trap_c + 0x0 }
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0xffa003ac> { _ex_workaround_261 + 0x1c }
Sep 3 07:15:59 blackfin user.notice kernel: 4 Target : <0xffa00390> { _ex_workaround_261 + 0x0 }
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0xffa00770> { _trap + 0x68 }
Sep 3 07:15:59 blackfin user.notice kernel: 5 Target : <0xffa00728> { _trap + 0x20 }
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0xffa00724> { _trap + 0x1c }
Sep 3 07:15:59 blackfin user.notice kernel: 6 Target : <0xffa00708> { _trap + 0x0 }
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0xffa004a4> { _bfin_return_from_exception + 0x20 }
Sep 3 07:15:59 blackfin user.notice kernel: 7 Target : <0xffa00484> { _bfin_return_from_exception + 0x0 }
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0xffa003a2> { _ex_workaround_261 + 0x12 }
Sep 3 07:15:59 blackfin user.notice kernel: 8 Target : <0xffa00390> { _ex_workaround_261 + 0x0 }
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0xffa00770> { _trap + 0x68 }
Sep 3 07:15:59 blackfin user.notice kernel: 9 Target : <0xffa00728> { _trap + 0x20 }
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0xffa00724> { _trap + 0x1c }
Sep 3 07:15:59 blackfin user.notice kernel: 10 Target : <0xffa00708> { _trap + 0x0 }
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0x0070b708> [ ftpd + 0xb6c8 ] 0xb9f0
Sep 3 07:15:59 blackfin user.notice kernel: 11 Target : <0x0070b704> [ ftpd + 0xb6c4 ]
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0x0070cb94> [ ftpd + 0xcb54 ] RTS
Sep 3 07:15:59 blackfin user.notice kernel: 12 Target : <0x0070cb88> [ ftpd + 0xcb48 ]
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0x0070b702> [ ftpd + 0xb6c2 ] CALL (P3)
Sep 3 07:15:59 blackfin user.notice kernel: 13 Target : <0x0070b6f0> [ ftpd + 0xb6b0 ]
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0x0070baa2> [ ftpd + 0xba62 ] RTS
Sep 3 07:15:59 blackfin user.notice kernel: 14 Target : <0x0070ba90> [ ftpd + 0xba50 ]
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0x0070ba68> [ ftpd + 0xba28 ] IF CC JUMP
Sep 3 07:15:59 blackfin user.notice kernel: 15 Target : <0x0070ba5a> [ ftpd + 0xba1a ]
Sep 3 07:15:59 blackfin user.notice kernel: Source : <0x0070ba4a> [ ftpd + 0xba0a ] IF CC JUMP
Sep 3 07:15:59 blackfin user.notice kernel: Userspace Stack
Sep 3 07:15:59 blackfin user.notice kernel: Stack info:
Sep 3 07:15:59 blackfin user.notice kernel: SP: [0x00728444] <0x00728444> [ ftpd + 0x28444 ]
Sep 3 07:15:59 blackfin user.notice kernel: FP: (0x00728e70)
Sep 3 07:15:59 blackfin user.notice kernel: Memory from 0x00728440 to 00729000
Sep 3 07:15:59 blackfin user.notice kernel: 00728440:<0070b704>[0072847c]<00707756> 00000000 007295e4 00000000 00000000 0000000c
Sep 3 07:15:59 blackfin user.notice kernel: 00728460:<0072848c><0070ac5a><00729460> 007295e0 <007284b8><00729640> 00000005 <00729640>
Sep 3 07:15:59 blackfin user.notice kernel: 00728480:<00704d0c><00729460> 007295e0 007295f8 <00704d96><00729640> 00000001 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007284a0: 00000000 00000010 00000000 007295e4 <007284b4> 00729638 007d2004 00715858
Sep 3 07:15:59 blackfin user.notice kernel: 007284c0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007284e0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728500: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728520: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728540: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728560: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728580: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007285a0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007285c0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007285e0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728600: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728620: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728640: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728660: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728680: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007286a0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007286c0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007286e0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728700: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728720: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728740: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728760: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728780: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007287a0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007287c0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007287e0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728800: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728820: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728840: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728860: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728880: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007288a0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007288c0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007288e0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728900: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728920: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728940: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728960: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728980: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007289a0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007289c0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 007289e0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728a00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728a20: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728a40: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728a60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728a80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728aa0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728ac0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728ae0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728b00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728b20: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728b40: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728b60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728b80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728ba0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728bc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728be0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728c00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728c20: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728c40: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728c60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728c80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728ca0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728cc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728ce0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728d00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728d20: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728d40: 00711f6c 00000000 00000000 00000000 00000000 00000000 00711f6c 00711f6c
Sep 3 07:15:59 blackfin user.notice kernel: 00728d60: 00000008 00000000 00000000 00000000 00000000 00711f6c 00000008 00000003
Sep 3 07:15:59 blackfin user.notice kernel: 00728d80:<00728db0> 00000000 00000000 00728ddc 00000008 00000008 0000002b 00728ef8
Sep 3 07:15:59 blackfin user.notice kernel: 00728da0:<00709362> 007142f0 00728ef8 <00709694> 00712517 0000002b 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728dc0: 00728ddc 00714036 ffffffff 00000000 00000064 <00728de0> 20000020 007142f2
Sep 3 07:15:59 blackfin user.notice kernel: 00728de0: ffffffff 00000000 00000073 00000000 00000020 00000000 00000001 00000013
Sep 3 07:15:59 blackfin user.notice kernel: 00728e00: 00010000 00000003 00000008 00000008 00000008 00000008 00000008 00000008
Sep 3 07:15:59 blackfin user.notice kernel: 00728e20: 00000008 00000008 <00728f80><00728f80> 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728e40: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728e60: 00000000 00000000 00000000 00000000 (00000000)<0070ada8> ffffffff 00000002
Sep 3 07:15:59 blackfin user.notice kernel: 00728e80: 00000000 00000000 <00728e8c> 00000000 <00728eb4><0070b81a><007157e0> 0072726c
Sep 3 07:15:59 blackfin user.notice kernel: 00728ea0: 0071583c 00000044 00728ed0 <0070916e> 0071575c <00728f04><00709ff6> 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728ec0: 0072726c <007156e4> 0071571c 00008030 <00728f04><00709f82><00728ef0><0070dc66>
Sep 3 07:15:59 blackfin user.notice kernel: 00728ee0:<00728f04><0070b81a><007157e0> 0070cb98 037ac104 00000104 00715840 <007091cc>
Sep 3 07:15:59 blackfin user.notice kernel: 00728f00: 00728f40 00728f54 <007089ba> 00715840 0070cb98 0070cb98 <00728f34> 00000000
Sep 3 07:15:59 blackfin user.notice kernel: 00728f20: 00000002 0000000a <00728f80> 00727960 <0072980c> 00715840 0071575c 00000002
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00728db0> [ ftpd + 0x28db0 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00709362> [ ftpd + 0x9322 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00709694> [ ftpd + 0x9654 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00728de0> [ ftpd + 0x28de0 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00728f80> [ ftpd + 0x28f80 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00728f80> [ ftpd + 0x28f80 ]
Sep 3 07:15:59 blackfin user.notice kernel: frame 1 : <0x0070ada8> [ ftpd + 0xad68 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00728e8c> [ ftpd + 0x28e8c ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00728eb4> [ ftpd + 0x28eb4 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x0070b81a> [ ftpd + 0xb7da ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x007157e0> [ ftpd + 0x157e0 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x0070916e> [ ftpd + 0x912e ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00728f04> [ ftpd + 0x28f04 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00709ff6> [ ftpd + 0x9fb6 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x007156e4> [ ftpd + 0x156e4 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00728f04> [ ftpd + 0x28f04 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00709f82> [ ftpd + 0x9f42 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00728ef0> [ ftpd + 0x28ef0 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x0070dc66> [ ftpd + 0xdc26 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00728f04> [ ftpd + 0x28f04 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x0070b81a> [ ftpd + 0xb7da ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x007157e0> [ ftpd + 0x157e0 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x007091cc> [ ftpd + 0x918c ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x007089ba> [ ftpd + 0x897a ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00728f34> [ ftpd + 0x28f34 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00728f80> [ ftpd + 0x28f80 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x0072980c> [ ftpd + 0x2980c ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x007023c2> [ ftpd + 0x2382 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00729780> [ ftpd + 0x29780 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00700448> [ ftpd + 0x408 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00728f80> [ ftpd + 0x28f80 ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x0072980c> [ ftpd + 0x2980c ]
Sep 3 07:15:59 blackfin user.notice kernel: address : <0x00728f80> [ ftpd + 0x28f80 ]
The release is 2009R1RC6, toolchain is 2009R1.
QuoteReplyEditDelete
2009-09-07 06:29:37 Re: ftpd crash
Barry Song (CHINA)
Message: 79638
Chris:
Yes. There is a loop stack alloc in:
while ((dir = readdir (dirp)) != NULL)
{
char *nbuf;
if (dir->d_name[0] == '.' && dir->d_name[1] == '\0')
continue;
if (dir->d_name[0] == '.' && dir->d_name[1] == '.' &&
dir->d_name[2] == '\0')
continue;
nbuf = (char *) alloca (strlen (dirname) + 1 +
strlen (dir->d_name) + 1);
sprintf (nbuf, "%s/%s", dirname, dir->d_name);
...
}
alloca gets memory from stack, so no matter how much size the stack is, there always be a day stack can overflow. and it is not suggested great by itself too. I will replace alloca by some other ways.
And except that, the original codes with stacksize=8K can always cause stack overflow in fact. For example:
void
retrieve (const char *cmd, const char *name)
{
FILE *fin, *dout;
struct stat st;
int (*closefunc) __P ((FILE *));
size_t buffer_size = 0;
...
char line[BUFSIZ];
...
}
BUFSIZ is 8K, so the old codes always have stack overflow . But the overflow doesn't always cause crash.
So the right fix is both increasing stack size and deleting alloca.
-barry
QuoteReplyEditDelete
2009-09-08 03:11:56 Re: ftpd crash
Barry Song (CHINA)
Message: 79665
Check cvsweb.netbsd.org/bsdweb.cgi/src/libexec/ftpd/, upstream has replaced alloca by temp variant buffer directly, so I merged these changes into blackfin 2009R1 and trunk head. This will fix the stack overflow when listing a directory with a lot of files.
--- branches/2009R1/user/ftpd/ftpd.c 2009-09-08 06:57:22 UTC (rev 8832)
+++ branches/2009R1/user/ftpd/ftpd.c 2009-09-08 06:59:41 UTC (rev 8833)
@@ -39,23 +39,6 @@
# include <config.h>
#endif
-#if !defined (__GNUC__) && defined (_AIX)
-#pragma alloca
-#endif
-#ifndef alloca /* Make alloca work the best possible way. */
-# ifdef __GNUC__
-# define alloca __builtin_alloca
-# else /* not __GNUC__ */
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else /* not __GNUC__ or HAVE_ALLOCA_H */
-# ifndef _AIX /* Already did AIX, up at the top. */
- char *alloca ();
-# endif /* not _AIX */
-# endif /* not HAVE_ALLOCA_H */
-# endif /* not __GNUC__ */
-#endif /* not alloca */
-
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
@@ -1903,6 +1886,8 @@
}
while ((dirname = *dirlist++))
{
+ int trailingslash = 0;
+
if (stat (dirname, &st) < 0)
{
/* If user typed "ls -l", etc, and the client
@@ -1941,13 +1926,16 @@
else if (!S_ISDIR (st.st_mode))
continue;
+ if (dirname[strlen(dirname) - 1] == '/')
+ trailingslash++;
+
dirp = opendir (dirname);
if (dirp == NULL)
continue;
while ((dir = readdir (dirp)) != NULL)
{
- char *nbuf;
+ char nbuf[MAXPATHLEN];
if (dir->d_name[0] == '.' && dir->d_name[1] == '\0')
continue;
@@ -1955,9 +1943,8 @@
dir->d_name[2] == '\0')
continue;
- nbuf = (char *) alloca (strlen (dirname) + 1 +
- strlen (dir->d_name) + 1);
- sprintf (nbuf, "%s/%s", dirname, dir->d_name);
+ (void)snprintf(nbuf, sizeof(nbuf), "%s%s%s", dirname,
+ trailingslash ? "" : "/", dir->d_name);
/* We have to do a stat to insure it's
not a directory or special file. */
-barry
QuoteReplyEditDelete
2009-09-08 12:27:48 Re: ftpd crash
Robin Getz (UNITED STATES)
Message: 79684
Barry:
Thanks for continuing to dig into this, and find the real fix.
Maybe we should take a snapshot of upstream's cvs, and put it into trunk for the next release? (I'm sure there are other fixes we should get too).
-Robin