Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 104311 - Segmentation Fault in net-ftp/ftp (version 0.17-r5) with vsftpd 2.0.3-r1
Summary: Segmentation Fault in net-ftp/ftp (version 0.17-r5) with vsftpd 2.0.3-r1
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
: 104498 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-08-30 15:49 UTC by martin
Modified: 2005-11-01 20:45 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
ftp-dont-strcpy-overlapping.patch (ftp-dont-strcpy-overlapping.patch,442 bytes, patch)
2005-10-13 22:02 UTC, SpanKY
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description martin 2005-08-30 15:49:11 UTC
This directory not exist: /this/directory/not/exist !!!

User: test
pass: passwordok

User dupadupa not exist !!!


maar@computer /home/maar $ gdb ftp
GNU gdb 6.3
Copyright 2004 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 "i686-pc-linux-gnu"...(no debugging symbols found)
Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) set logging file log
(gdb) set logging on
Copying output to log.
(gdb) r server
Starting program: /usr/bin/ftp server
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
Connected to server (192.168.1.1).
220 Ziomal
Name (server:maar): dupadupa
530 Please login with USER and PASS.
SSL not available
331 Please specify the password.
Password:
530 Login incorrect.
Login failed.
ftp> user test
331 Please specify the password.
Password: passwordok
500 OOPS: cannot change directory:/this/directory/not/exist
Login failed.
ftp> ls -la
500 OOPS: child died
ftp: bind: Address already in use
ftp> ls -la

Program received signal SIGPIPE, Broken pipe.
0xb7cd5098 in write () from /lib/libc.so.6
(gdb) br
Breakpoint 1 at 0xb7cd5098
(gdb) bt
#0  0xb7cd5098 in write () from /lib/libc.so.6
#1  0xb7d3eff4 in ?? () from /lib/libc.so.6
#2  0xb7c87b62 in _IO_file_write () from /lib/libc.so.6
#3  0xb7c86532 in _IO_file_setbuf () from /lib/libc.so.6
#4  0xb7c86658 in _IO_do_write () from /lib/libc.so.6
#5  0xb7c871f2 in _IO_file_sync () from /lib/libc.so.6
#6  0xb7c7c5ff in fflush () from /lib/libc.so.6
#7  0x0804fd5a in ?? ()
#8  0x08076d58 in ?? ()
#9  0x08076d58 in ?? ()
#10 0x08058dd0 in _IO_stdin_used ()
#11 0xbf900684 in ?? ()
#12 0x54524f50 in ?? ()
#13 0x32393120 in ?? ()
#14 0x3836312c in ?? ()
#15 0x322c312c in ?? ()
#16 0x3832312c in ?? ()
#17 0x0d38332c in ?? ()
#18 0x0000000a in ?? ()
#19 0x00000000 in ?? ()
#20 0x00000000 in ?? ()
#21 0x00000000 in ?? ()
#22 0x00000000 in ?? ()
#23 0x00000000 in ?? ()
#24 0x00000000 in ?? ()
#25 0x00000000 in ?? ()
#26 0x00000000 in ?? ()
#27 0x00000000 in ?? ()
#28 0x00000080 in ?? ()
#29 0xb7d3eff4 in ?? () from /lib/libc.so.6
#30 0xbf8fe770 in ?? ()
#31 0x00000002 in ?? ()
#32 0xbf8fe6c8 in ?? ()
#33 0xb7c515d4 in sigaction () from /lib/libc.so.6
Previous frame inner to this frame (corrupt stack?)
(gdb) 

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 SpanKY gentoo-dev 2005-08-31 10:22:53 UTC
we need more info here ... you neglected `emerge info` for starters ...

how do you have vsftp setup such that it's giving you this bad behavior ?

re-emerge ftp like this:
FEATURES=nostrip CFLAGS='-pipe -O1 -g -ggdb' emerge ftp

and then run it through gdb again
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2005-09-01 14:56:34 UTC
*** Bug 104498 has been marked as a duplicate of this bug. ***
Comment 3 martin 2005-09-01 23:38:10 UTC
iraq new # emerge info
Portage 2.0.51.22-r2 (default-linux/x86/2005.0, gcc-3.4.4, glibc-2.3.5-r1,
2.6.12-gentoo-r6 i686)
=================================================================
System uname: 2.6.12-gentoo-r6 i686 Pentium III (Coppermine)
Gentoo Base System version 1.12.0_pre6
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-lang/python:     2.3.4-r1, 2.4.1-r1
sys-apps/sandbox:    1.2.11
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.18-r1
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium3 -O2 -pipe -s -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/share/config /var/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium3 -02 -pipe -s"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.zie.pg.gda.pl http://lug.mtu.edu/gentoo
http://mir.zyrianes.net/gentoo/ http://mirror.aiya.ru/pub/gentoo/
http://mirror.averse.net/pub/gentoo/
http://mirror.clarkson.edu/pub/distributions/gentoo/
http://mirror.datapipe.net/gentoo http://mirror.espri.arizona.edu/gentoo/
http://mirror.etf.bg.ac.yu/gentoo http://mirror.gentoo.gr.jp
http://mirror.gentoo.no/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 apache2 apm arts avi berkdb bitmap-fonts bzip2 crypt cups curl eds
emboss emerge encode foomaticdb fortran freetds gd gdbm gif gpm gstreamer gzip
imlib ipv6 java jpeg libg++ libwww mad mikmod motif mp3 mpeg mssql mysql ncurses
nls ogg oggvorbis opengl oss pam pdflib perl php png python quicktime readline
sdl spell ssl tcpd truetype truetype-fonts type1-fonts vorbis xml xml2 xmms xv
zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY

iraq new # emerge -s vsftpd
Searching...
[ Results for search key : vsftpd ]
[ Applications found : 1 ]

*  net-ftp/vsftpd
      Latest version available: 2.0.3-r1
      Latest version installed: 2.0.3-r1
      Size of downloaded files: 149 kB
      Homepage:    http://vsftpd.beasts.org/
      Description: Very Secure FTP Daemon written with speed, size and security
in mind
      License:     GPL-2


iraq new # cat /etc/vsftpd/vsftpd.conf
background=YES
listen=YES

anonymous_enable=NO

local_enable=YES

write_enable=YES

local_umask=022

anon_upload_enable=NO

#anon_mkdir_write_enable=YES

dirmessage_enable=YES

connect_from_port_20=YES

#chown_uploads=YES
#chown_username=whoever

xferlog_enable=YES

#xferlog_std_format=YES

xferlog_file=/var/log/vsftpd.log

#idle_session_timeout=600

#data_connection_timeout=120

nopriv_user=nobody

#async_abor_enable=YES

#ascii_upload_enable=YES
#ascii_download_enable=YES

ftpd_banner=Server

#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/vsftpd.banned_emails

chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/vsftpd.chroot_list

#ls_recurse_enable=YES

iraq new # cat /etc/vsftpd/vsftpd.chroot_list | grep test
test
iraq new # emerge -s ftp | more
(...)
*  net-ftp/ftp
      Latest version available: 0.17-r5
      Latest version installed: 0.17-r5
      Size of downloaded files: 52 kB
      Homepage:    http://www.hcs.harvard.edu/~dholland/computers/netkit.html
      Description: Standard Linux FTP client
      License:     as-is


iraq new # cat /etc/passwd | grep test
test:x:1001:100::/home/ftp/apollo:/bin/false
iraq new # cat /etc/passwd | grep maar
maar:x:1000:100::/home/maar:/bin/bash
iraq new # ls -la /home/ftp/apollo
ls: /home/ftp/apollo: No such file or directory
iraq new # ls -la /home/ftp
total 8
drwxr-xr-x  2 root root 4096 Aug 29 01:07 .
drwxr-xr-x  8 root root 4096 Aug 29 01:07 ..
iraq new # gdb ftp
GNU gdb 6.3
Copyright 2004 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 "i686-pc-linux-gnu"...Using host libthread_db library
"/lib/libthread_db.so.1".

(gdb) r localhost
Starting program: /usr/bin/ftp localhost
Connected to localhost (127.0.0.1).
220 Server
Name (localhost:maar): maar
530 Please login with USER and PASS.
SSL not available
331 Please specify the password.
Password: (password ok)
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x    2 1000     100          4096 Aug 30 20:49 isec
-rwxr--r--    1 1000     100          1090 Aug 24 15:49 level3
-rw-r--r--    1 1000     100            40 Sep 01 13:28 muza
-rwx------    1 1000     100          2247 Jul 11 19:46 muza.txt
-rwx------    1 1000     100           557 Jul 19 12:33 prog.c
226 Directory send OK.
ftp> close
221 Goodbye.
ftp> open localhost
Connected to localhost (127.0.0.1).
220 Server
Name (localhost:maar): maar
530 Please login with USER and PASS.
SSL not available
331 Please specify the password.
Password: (bad password)
530 Login incorrect.
Login failed.
ftp> user test
331 Please specify the password.
Password: (password ok)
500 OOPS: cannot change directory:/home/ftp/apollo
Login failed.
ftp> ls
500 OOPS: child died

Program received signal SIGPIPE, Broken pipe.
0xb7d77098 in write () from /lib/libc.so.6
(gdb) bt
#0  0xb7d77098 in write () from /lib/libc.so.6
#1  0xb7de0ff4 in ?? () from /lib/libc.so.6
#2  0xb7d29b62 in _IO_file_write () from /lib/libc.so.6
#3  0xb7d28532 in _IO_file_setbuf () from /lib/libc.so.6
#4  0xb7d28658 in _IO_do_write () from /lib/libc.so.6
#5  0xb7d291f2 in _IO_file_sync () from /lib/libc.so.6
#6  0xb7d1e5ff in fflush () from /lib/libc.so.6
#7  0x0804f4de in command (fmt=0x8056cd6 "%s") at ftp.c:442
#8  0x08050e57 in recvrequest (cmd=0x8056c31 "LIST", local=0x8059400 "-",
remote=0x0,
    lmode=0x805690e "w", printnames=0) at ftp.c:1036
#9  0x0804cc1c in ls (argc=-32, argv=0x8065120) at cmds.c:1427
#10 0x0805595a in cmdscanner (top=1) at main.c:488
#11 0x08055656 in main (argc=1, argv=0xbfaa3c78) at main.c:357
(gdb) r localhost
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /usr/bin/ftp localhost
Connected to localhost (127.0.0.1).
220 Server
Name (localhost:maar): test
530 Please login with USER and PASS.
SSL not available
331 Please specify the password.
Password: (password ok)
500 OOPS: cannot change directory:/home/ftp/apollo
Login failed.
421 Service not available, remote server has closed connection
ftp> ls
Not connected.
ftp> ls
Not connected.
ftp>open localhost
Connected to localhost (127.0.0.1).
220 Server
Name (localhost:maar): maar
530 Please login with USER and PASS.
SSL not available
331 Please specify the password.
Password: (bad password)
530 Login incorrect.
Login failed.
ftp> user test
331 Please specify the password.
Password: (password ok)
500 OOPS: cannot change directory:/home/ftp/apollo
Login failed.
ftp> ls -la
500 OOPS: child died

Program received signal SIGPIPE, Broken pipe.
0xb7d94098 in write () from /lib/libc.so.6
(gdb) bt
#0  0xb7d94098 in write () from /lib/libc.so.6
#1  0xb7dfdff4 in ?? () from /lib/libc.so.6
#2  0xb7d46b62 in _IO_file_write () from /lib/libc.so.6
#3  0xb7d45532 in _IO_file_setbuf () from /lib/libc.so.6
#4  0xb7d45658 in _IO_do_write () from /lib/libc.so.6
#5  0xb7d461f2 in _IO_file_sync () from /lib/libc.so.6
#6  0xb7d3b5ff in fflush () from /lib/libc.so.6
#7  0x0804f4de in command (fmt=0x8056d5d "%s %s") at ftp.c:442
#8  0x08050e27 in recvrequest (cmd=0x8056c31 "LIST", local=0x8059400 "-",
remote=0x8069623 "-la",
    lmode=0x805690e "w", printnames=0) at ftp.c:1030
#9  0x0804cc1c in ls (argc=-32, argv=0x8065120) at cmds.c:1427
#10 0x0805595a in cmdscanner (top=1) at main.c:488
#11 0x08055656 in main (argc=1, argv=0xbfac26b8) at main.c:357
(gdb) quit
Comment 4 martin 2005-09-02 13:29:43 UTC
Any ideas ?
Comment 5 martin 2005-09-16 10:18:49 UTC
Hellooooo!!!

Who know, where is the bug ??

How fix this bug ??

Please answer.
Comment 6 SpanKY gentoo-dev 2005-10-13 22:02:02 UTC
Created attachment 70640 [details, diff]
ftp-dont-strcpy-overlapping.patch

try this patch and see if it fixes your segfault
Comment 7 SpanKY gentoo-dev 2005-10-13 22:44:26 UTC
Comment on attachment 70640 [details, diff]
ftp-dont-strcpy-overlapping.patch

better yet, sync up and emerge ftp-0.17-r6

it is currently KEYWORDS=-* so you'll have to emerge it by hand
Comment 8 martin 2005-11-01 07:57:02 UTC
THX, it works OK.
Comment 9 SpanKY gentoo-dev 2005-11-01 20:45:24 UTC
thanks, moved into ~arch