From owner-freebsd-current Fri Dec 4 18:39:47 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id SAA24241 for freebsd-current-outgoing; Fri, 4 Dec 1998 18:39:47 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from lamb.sas.com (lamb.sas.com [192.35.83.8]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id SAA24234 for ; Fri, 4 Dec 1998 18:39:44 -0800 (PST) (envelope-from jwd@unx.sas.com) Received: from mozart (mozart.unx.sas.com [192.58.184.8]) by lamb.sas.com (8.9.1/8.9.1) with SMTP id VAA13238 for ; Fri, 4 Dec 1998 21:39:28 -0500 (EST) Received: from bb01f39.unx.sas.com by mozart (5.65c/SAS/Domains/5-6-90) id AA23853; Fri, 4 Dec 1998 21:39:28 -0500 Received: (from jwd@localhost) by bb01f39.unx.sas.com (8.9.1/8.9.1) id VAA02555; Fri, 4 Dec 1998 21:39:27 -0500 (EST) (envelope-from jwd) From: "John W. DeBoskey" Message-Id: <199812050239.VAA02555@bb01f39.unx.sas.com> Subject: Something fishy with telnetd (non-zero initialized static?) To: freebsd-current@FreeBSD.ORG Date: Fri, 4 Dec 1998 21:39:27 -0500 (EST) X-Mailer: ELM [version 2.4ME+ PL38 (25)] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, The following is from a 3.0-19981202-SNAP system. When I telnet into this newly installed system, the prompt I get is: --------------------------------------------------------- Connected to bb08f01.unx.sas.com. Escape character is '^]'. / (bb08f01.unx.sas.com) (ttyp1) login: --------------------------------------------------------- Note the '/' char in column one. Well, I say, "It shouldn't be like that, it should look like:" --------------------------------------------------------- Connected to bb08f01.unx.sas.com. Escape character is '^]'. FreeBSD/i386 (bb08f01.unx.sas.com) (ttyp1) login: --------------------------------------------------------- I have verified that this bug occurs on 2 different installations of the 3.0-19981202-SNAP. Too make a long story short, the following code in /usr/src/libexec/telnetd/utility.c looks to be the fishy culprit to me (added: 1.8 Sun Feb 2 7:33:50 1997 UTC by davidn): #ifdef __FreeBSD__ static struct utsname kerninfo; if (!*kerninfo.sysname) uname(&kerninfo); #endif Well, I ktraced /usr/libexec/telnetd (minor change to inetd.conf), and sysctl() is never being called, thus I assume that the 'if' statement is false (should be true). To prove myself correct, I rebuilt and installed a debug version of telnetd where I memset() kerninfo to zero and the 5 sysctl() calls in uname() show up correctly. I wonder if we are getting non-zero pages mapped in... ??? Below are the relevant portions of the ktrace output. Any comments, ideas, critiques, etc, are welcome at this point. Thanks! John --- Failing telnetd ------------------------------------- std.230400|230400-baud:\\ :np:sp#230400: # # " 3725 telnetd RET read 1024/0x400 3725 telnetd CALL close(0x4) 3725 telnetd RET close 0 3725 telnetd CALL madvise(0x805e000,0x1000,0x5) 3725 telnetd RET madvise 0 * * * sysctl() calls missing here * * 3725 telnetd CALL ioctl(0x3,TIOCGETA,0x8059d44) 3725 telnetd RET ioctl 0 3725 telnetd CALL ioctl(0x3,TIOCGETA,0x8059d44) 3725 telnetd RET ioctl 0 3725 telnetd CALL write(0,0x80592a0,0xc) 3725 telnetd GIO fd 0 wrote 12 bytes "\M^?\M-{\^A\M^?\M-z!\^B\M^?\M-p\M^?\M-~"" 3725 telnetd RET write 12/0xc 3725 telnetd CALL ioctl(0x3,TIOCSWINSZ,0xefbfd6bc) 3725 telnetd RET ioctl 0 3725 telnetd CALL ioctl(0x3,TIOCGETA,0x8059d44) 3725 telnetd RET ioctl 0 3725 telnetd CALL write(0,0x80592a0,0x38) 3725 telnetd GIO fd 0 wrote 56 bytes "\M^?\M-z"\^C\^A\0\0\^C\M-b\^C\^D\M^B\^O\^E\M^B\^T\a\M-b\^\\b\M^B\^D\ \M-B\^Z \M^B\^?\v\M^B\^U\f\M^B\^W\r\M^B\^R\^N\M^B\^V\^O\M^B\^Q\^P\M^B\^S\^Q\ \M^@\M^?\M^?\^R\M^@\M^?\M^?\M^?\M-p" 3725 telnetd RET write 56/0x38 3725 telnetd CALL madvise(0x805c000,0x1000,0x5) 3725 telnetd RET madvise 0 3725 telnetd CALL fork 3725 telnetd RET fork 3726/0xe8e 3725 telnetd CALL select(0x4,0xefbfd7f8,0xefbfd778,0xefbfd6f8,0) 3725 telnetd RET select 2 3725 telnetd CALL read(0,0x8058da0,0x400) 3725 telnetd GIO fd 0 read 6 bytes "\M^?\M-}\^A\M^?\M-|"" 3725 telnetd RET read 6 3725 telnetd CALL write(0,0x80592a0,0x25) 3725 telnetd GIO fd 0 wrote 37 bytes "\r / (bb08f01.unx.sas.com) (ttyp1)\r \r " --- Working telnetd ------------------------------------- std.230400|230400-baud:\\ :np:sp#230400: # # " 3721 telnetd RET read 1024/0x400 3721 telnetd CALL close(0x4) 3721 telnetd RET close 0 3721 telnetd CALL madvise(0x8057000,0x1000,0x5) 3721 telnetd RET madvise 0 3721 telnetd CALL __sysctl(0xefbfd5e8,0x2,0x80516b0,0xefbfd5f0,0,0) 3721 telnetd RET __sysctl 0 3721 telnetd CALL __sysctl(0xefbfd5e8,0x2,0x80516d0,0xefbfd5f0,0,0) 3721 telnetd RET __sysctl 0 3721 telnetd CALL __sysctl(0xefbfd5e8,0x2,0x80516f0,0xefbfd5f0,0,0) 3721 telnetd RET __sysctl 0 3721 telnetd CALL __sysctl(0xefbfd5e8,0x2,0x8051710,0xefbfd5f0,0,0) 3721 telnetd RET __sysctl -1 errno 12 Cannot allocate memory 3721 telnetd CALL __sysctl(0xefbfd5e8,0x2,0x8051730,0xefbfd5f0,0,0) 3721 telnetd RET __sysctl 0 3721 telnetd CALL ioctl(0x3,TIOCGETA,0x8052a94) 3721 telnetd RET ioctl 0 3721 telnetd CALL ioctl(0x3,TIOCGETA,0x8052a94) 3721 telnetd RET ioctl 0 3721 telnetd CALL write(0,0x8051ff0,0xc) 3721 telnetd GIO fd 0 wrote 12 bytes "\M^?\M-{\^A\M^?\M-z!\^B\M^?\M-p\M^?\M-~"" 3721 telnetd RET write 12/0xc 3721 telnetd CALL ioctl(0x3,TIOCSWINSZ,0xefbfd664) 3721 telnetd RET ioctl 0 3721 telnetd CALL ioctl(0x3,TIOCGETA,0x8052a94) 3721 telnetd RET ioctl 0 3721 telnetd CALL write(0,0x8051ff0,0x38) 3721 telnetd GIO fd 0 wrote 56 bytes "\M^?\M-z"\^C\^A\0\0\^C\M-b\^C\^D\M^B\^O\^E\M^B\^T\a\M-b\^\\b\M^B\^D\ \M-B\^Z \M^B\^?\v\M^B\^U\f\M^B\^W\r\M^B\^R\^N\M^B\^V\^O\M^B\^Q\^P\M^B\^S\^Q\ \M^@\M^?\M^?\^R\M^@\M^?\M^?\M^?\M-p" 3721 telnetd RET write 56/0x38 3721 telnetd CALL madvise(0x8055000,0x1000,0x5) 3721 telnetd RET madvise 0 3721 telnetd CALL fork 3721 telnetd RET fork 3722/0xe8a 3721 telnetd CALL select(0x10,0xefbfd7a8,0xefbfd728,0xefbfd6a8,0) 3721 telnetd RET select 2 3721 telnetd CALL read(0,0x8051af0,0x400) 3721 telnetd GIO fd 0 read 6 bytes "\M^?\M-}\^A\M^?\M-|"" 3721 telnetd RET read 6 3721 telnetd CALL write(0,0x8051ff0,0x36) 3721 telnetd GIO fd 0 wrote 54 bytes "\r\0\r FreeBSD/i386 (bb08f01.unx.sas.com) (ttyp1)\r\0\r \r\0\r " 3721 telnetd RET write 54/0x36 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message