From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29172 invoked by alias); 25 May 2002 23:56:36 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 29165 invoked from network); 25 May 2002 23:56:34 -0000 Received: from unknown (HELO lombi.mine.nu) (217.162.208.147) by sources.redhat.com with SMTP; 25 May 2002 23:56:34 -0000 Received: (qmail 21336 invoked from network); 25 May 2002 23:55:09 -0000 Received: from unknown (HELO ?192.168.3.11?) (192.168.3.11) by 192.168.3.1 with SMTP; 25 May 2002 23:55:09 -0000 Mime-Version: 1.0 X-Sender: jaeger@192.168.3.1 Message-Id: Date: Sat, 25 May 2002 16:56:00 -0000 To: gdb@sources.redhat.com From: Christian Jaeger Subject: lin-lwp.c assertion failures Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-SW-Source: 2002-05/txt/msg00281.txt.bz2 Hello I'm having a hard time trying to use gdb on proftpd (and also afpd) server childs that have LD_PRELOAD'ed a shared library. The shared lib intercepts glibc/system calls (mainly filesystem calls), and also loads a perl interpreter - it serves filesystem calls to a part of the file tree (virtual filesystem), the basis is the AVFS-preload library from Frederik Eaton. Gdb gives an internal error when the server child segfaults, or also when I interrupt the child from gdb. In detail: I can attach to the child process i.e. while it is waiting for user input from authentification, and it (at least gvd) is also showing the correct position in the virtual select() code; I give 'continue', gdb waits; I enter the authentification data over the wire, now the server child segfaults probably because of some bug in my code. gdb gives an internal error message, and even when I say Y to continue debugging, it doesn't seem to work anymore. Below you find the output from this session. I've also appended part of the strace -p `childpid` output from another identical session without an attached gdb. (This is gdb packaged for Debian Woody or unstable, running on kernel 2.4.18) Are these problems coming from "too much different code in the same process", or is it because I'm trapping glibc calls, or is it simply a gdb bug? What can I do? The bad thing is that I also can't get core dumps since proftpd changes uid and linux won't drop any core after that. Thanks for any help or ideas Christian. root@pflanze root# ps aux|grep proftpd nobody 23341 0.0 4.4 17668 11264 ? S 00:10 0:00 proftpd (accepting connections) nobody 23437 0.1 4.5 17784 11616 ? S 00:39 0:00 proftpd: connected: chris (192.168.1.8) root@pflanze root# gdb /usr/sbin/proftpd 23437 GNU gdb 2002-04-01-cvs 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 "i386-linux"...(no debugging symbols found)... Attaching to program: /usr/sbin/proftpd, process 23437 Reading symbols from /home/chris/avfs-0.9.0-fe6/preload/avfs_preload.so...done. Loaded symbols for /home/chris/avfs-0.9.0-fe6/preload/avfs_preload.so Reading symbols from /lib/libcrypt.so.1...done. Loaded symbols for /lib/libcrypt.so.1 Reading symbols from /usr/lib/libssl.so.0.9.6...done. Loaded symbols for /usr/lib/libssl.so.0.9.6 ... ... Reading symbols from /usr/lib/libperl.so.5.6...done. ... Reading symbols from /usr/lib/perl/5.6.1/auto/POSIX/POSIX.so...done. ... Loaded symbols for /usr/lib/perl5/auto/Image/Magick/Magick.so Reading symbols from /usr/lib/libMagick.so.5...done. Loaded symbols for /usr/lib/libMagick.so.5 ... Reading symbols from /lib/libpthread.so.0...done. [New Thread 1024 (LWP 23337)] Error while reading shared library symbols: Can't attach LWP 23337: No such process Reading symbols from /usr/lib/libwmf-0.2.so.2...done. ... Loaded symbols for /lib/libresolv.so.2 0x4024ce1e in select () from /lib/libc.so.6 (gdb) continue Continuing. ../../gdb/lin-lwp.c:1105: gdb-internal-error: lin_lwp_wait: Assertion `WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP' failed. An internal GDB error was detected. This may make further debugging unreliable. Quit this debugging session? (y or n) n Create a core file containing the current state of GDB? (y or n) y (gdb) bt #0 0x4024ce1e in select () from /lib/libc.so.6 #1 0x0877515c in ?? () #2 0x08051685 in strcpy () Cannot access memory at address 0x7 (gdb) root@pflanze root# strace -p 23713 select(1, [0], NULL, NULL, {40, 930000}) = 1 (in [0], left {38, 850000}) read(0, "PASS s9i2fhsu1d\r\n", 1022) = 18 alarm(0) = 277 alarm(277) = 0 close(4) = 0 munmap(0x404c4000, 4096) = 0 close(5) = 0 munmap(0x404c5000, 4096) = 0 ... ...(quite much stuff) ... time([1022369441]) = 1022369441 getpid() = 23713 geteuid32() = 1024 getegid32() = 107 flock(9, LOCK_EX) = 0 lseek(9, 644, SEEK_SET) = 644 read(9, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 644) = 644 read(9, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 644) = 644 read(9, "", 644) = 0 lseek(9, 644, SEEK_END) = 2576 lseek(9, 644, SEEK_SET) = 644 write(9, "\241\\\0\0\0\4\0\0k\0\0\0\0\0\0\0004\10\0\0\241\36\360"..., 644) = 644 flock(9, LOCK_UN) = 0 alarm(0) = 277 alarm(577) = 0 --- SIGSEGV (Segmentation fault) --- rt_sigaction(SIGSEGV, {SIG_DFL}, {0x804f0d0, [SEGV], SA_RESTART|0x4000000}, 8) = 0 brk(0x8794000) = 0x8794000 time([1022369441]) = 1022369441 getpid() = 23713 rt_sigaction(SIGPIPE, {0x4024f578, [], 0x4000000}, {SIG_IGN}, 8) = 0 send(2, "<27>May 26 01:30:41 proftpd[2371"..., 99, 0) = 99 rt_sigaction(SIGPIPE, {SIG_IGN}, NULL, 8) = 0 rt_sigprocmask(SIG_BLOCK, [HUP INT QUIT BUS USR1 ALRM TERM CHLD IO], NULL, 8) = 0 getpid() = 23713 write(6, "CDEBUG(23713): VIRT_SETEUID call"..., 35) = 35 setresuid32(0xffffffff, 0, 0xffffffff) = 0 getuid32() = 0 getuid32() = 0 time([1022369441]) = 1022369441 getpid() = 23713 rt_sigaction(SIGPIPE, {0x4024f578, [], 0x4000000}, {SIG_IGN}, 8) = 0 send(2, "<38>May 26 01:30:41 PAM_unix[237"..., 81, 0) = 81 rt_sigaction(SIGPIPE, {SIG_IGN}, NULL, 8) = 0 close(2) = 0 munmap(0x4050f000, 11788) = 0 munmap(0x40a30000, 94144) = 0 geteuid32() = 0 getpid() = 23713 write(6, "CDEBUG(23713): VIRT_SETEUID call"..., 35) = 35 setresuid32(0xffffffff, 0x400, 0xffffffff) = 0 rt_sigprocmask(SIG_UNBLOCK, [HUP INT QUIT BUS USR1 ALRM TERM CHLD IO], NULL, 8) = 0 getpid() = 23713 getpid() = 23713 write(6, "CDEBUG(23713): VIRT___FXSTAT64: "..., 62) = 62 fstat64(7, {st_mode=S_IFREG|0664, st_size=259200, ...}) = 0 getpid() = 23713 time([1022369441]) = 1022369441 write(7, "\10\0\0\0\241\\\0\0ftpd23713\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384 getpid() = 23713 geteuid32() = 1024 getegid32() = 107 flock(9, LOCK_EX) = 0 lseek(9, 644, SEEK_SET) = 644 read(9, "\241\\\0\0\0\4\0\0k\0\0\0\0\0\0\0004\10\0\0\241\36\360"..., 644) = 644 lseek(9, 644, SEEK_SET) = 644 write(9, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 644) = 644 flock(9, LOCK_UN) = 0 close(9) = 0 _exit(1) = ? -- Christian Jaeger Programmer & System Engineer +41 1 430 45 26 ETHLife CMS Project - www.ethlife.ethz.ch/newcms - www.ethlife.ethz.ch