From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 1307 invoked from network); 3 Oct 1998 00:57:31 -0000 Received: from mail.redhat.com (199.183.24.239) by mail2.redhat.com with SMTP; 3 Oct 1998 00:57:31 -0000 Received: from earth.terran.org (bryan@earth.terran.org [208.152.24.33]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id UAA04053 for ; Fri, 2 Oct 1998 20:55:04 -0400 Received: from localhost (bryan@localhost) by earth.terran.org (8.8.7/8.8.9) with SMTP id RAA05206 for ; Fri, 2 Oct 1998 17:58:45 -0700 Date: Fri, 2 Oct 1998 17:58:45 -0700 (PDT) From: "B. James Phillippe" To: axp-list@redhat.com Subject: Re: runaway klogd/syslogd happening now In-Reply-To: <199810030029.UAA15757@adder.cs.Virginia.EDU> Message-ID: Organization: Terran.ORG/LinuxWorld.NET X-Subliminal-Message: Use Linux MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Fri, 2 Oct 1998, Greg Lindahl wrote: > > klogd: > > > > write(1, "<3>Oct 2 14:29:51 kernel: Canno"..., 82) = 82 > > read(15913, 0x120107f84, 4096) = -1 EBADF (Bad file descriptor) > > And here we see klogd is reading from a bogus file descriptor. A > process-local bug, probably not a kernel bug. > > That doesn't tell you how klogd got the bogus fd, but it should be > enough for RedHat to at least insert a workaround. The only file descriptor klogd should be reading is /proc/kmsg. You can verify this by: Get the pid of klogd; ps has it, and so does top (which he posted output from previously). % ps aux|grep klog bryan 20395 0.0 0.3 936 316 p7 S 17:32 0:00 grep klog root 147 0.0 0.2 968 200 ? S Aug 25 0:00 klogd % Now look in the directory /proc/PID/fd (as root). % ls -l /proc/147/fd total 0 lr-x------ 1 root root 64 Oct 2 17:33 0 -> [0001]:5 lrwx------ 1 root root 64 Oct 2 17:33 1 -> [0000]:480 % There are two filedescriptors; 0 and 1. fd0 is on device 00:01 (the /proc filesystem) attached to inode #5, and fd1 is on device 00:00 (a UNIX domain socket) attached to inode #480. I can guess that fd0 is for input and fd1 is for output (based on the permissions of the files). netstat can find the UNIX domain socket (not that we need it; we know there's not a problem writing, but it's fun to hunt down anyway). % netstat .... Active UNIX domain sockets (w/o servers) Proto RefCnt Flags Type State I-Node Path unix 2 [ ] STREAM CONNECTED 480 unix 2 [ ] STREAM 481 /dev/log ........ % Okay, so that must be how klogd communicates with syslogd. One down, one to go. We can use find to find the file matching inode #5 on device 00:01. % find /proc -inum 5 /proc/kmsg % Ah, this is how klogd gets kernel messages.. so everything klogd said was true; it can't read the /proc filesystem. Can another user-space utility open and read from this file while klogd is spinning? For instance, when you "cat /proc/kmsg", what do you see? As for the cause of this problem, I think Uncle George posted a reasonable-sounding explanation. IIRC, it was that use of an unimplemented syscall returned a kernel error message that was not terminated by a newline, many times over, and klogd trashes it's stack trying to parse it, and ... ? Am I warm? -bp -- B. James Phillippe . bryan@terran.org UNIX Software Engineer . http://www.terran.org/~bryan Member since 1.1.59 . finger:bryan@earth.terran.org MOTM: Waiting for the DSL to go in :)