Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* runaway klogd/syslogd happening now
@ 1998-10-02 19:30 Craig P Prescott
  1998-10-02 22:39 ` Uncle George
  1998-10-03  3:00 ` Paul Tomblin
  0 siblings, 2 replies; 31+ messages in thread
From: Craig P Prescott @ 1998-10-02 19:30 UTC (permalink / raw)
  To: axp-list


Hi, all;

We have 13 533 MHz 164LXs in a producing high energy physics
simulation data.  Two of these nodes are presently suffering from the
"klogd and syslogd are eating all the CPU" problem, so I thought I
would post and ask the readers of this list if there is any more
information I can provide regarding this problem, in the hope that
additional info can help to solve this problem once and for all.
Barring any responses, at least this can be a data point.  I will not
restart the logging daemons on these boxes for at least a few hours to
give time for replies from the group.

Enclosed below is some info which may be helpful.  These are 5.0 boxes
running kernel 2.0.32 with patches.  I know the kernel version is
ancient...  Microway set these boxes up a bit weird when we purchased
them, IMHO - I'll be installing 5.1 from scratch during the next down
time.

This particular problem has never happened here when the nodes are
idling (i.e., not running the big simulation jobs).  This means CPU
load and network access.  

We've been running since May or so, and we switched from hard mounting
all the disks to using amd during the first few weeks of running.  I
mention this since I don't recall us having this problem before we
went to using automount.  I know this is a shot in the dark, but do
the others who suffer from this problem also use amd?  amd -v output
is at the end of this note.

Anyway, if I can provide any more useful info, please tell me what to
do.  Also, as I have never used strace before, any pointers on how to
get the most useful info out of it would be appreciated.

Many thanks in advance,
Craig
---
Craig P Prescott                              (352) 846-3145 (Phone)
2011 New Physics Building                     (352) 392-8863 (Fax)
University of Florida, Gainesville, FL 32611  prescott@phys.ufl.edu


[root@helix01 /root]# uname -a
Linux helix01 2.0.32 #1 Mon Mar 23 12:52:55 EST 1998 alpha unknown
[root@helix01 /root]# cat /etc/redhat-release 
release 5.0 (Hurricane)
[root@helix01 /root]# cat /proc/sys/kernel/file-max
1024
[root@helix01 /root]# cat /proc/sys/kernel/file-nr
320
[root@helix01 /root]# cat /proc/sys/kernel/inode-max 
3072
[root@helix01 /root]# cat /proc/sys/kernel/inode-nr 
920     665
[root@helix01 /root]# grep initdefault /etc/inittab | grep id
id:3:initdefault:
[root@helix01 /root]# ls /etc/rc.d/rc3.d/
K10named        K40snmpd        S30syslog       S60lpd          S80sendmail
K15gpm          K55routed       S40atd          S60nfs          S99local
K15httpd        K98kerneld      S40crond        S60nfs.rpmsave
K15sound        S10network      S40portmap      S60rwhod
K20rusersd      S15nfsfs        S50inet         S72amd
K35smb          S20random       S55ypbind       S75keytable
[root@helix01 /root]# strace -V
strace -- version 3.1
[root@helix01 /root]# top
  2:23pm  up 4 days,  4:23,  3 users,  load average: 2.94, 2.61, 2.60
47 processes: 41 sleeping, 5 running, 1 zombie, 0 stopped
CPU states: 72.4% user, 27.4% system,  0.0% nice,  0.4% idle
Mem:  125760K av, 124312K used,   1448K free,  31536K shrd,   5728K buff
Swap: 523640K av,   1568K used, 522072K free                 66960K cached

  PID USER     PRI  NI  SIZE  RSS SHARE STAT  LIB %CPU %MEM   TIME COMMAND
  165 root      19   0   632  608   488 R     560 26.0  0.2 469:31 klogd
  156 root      19   0   920  800   696 S     728 25.7  0.3 461:07 syslogd
15116 cleomc    20   0 42376  41M  5416 R     35M 23.6 16.8   1:05 cleog
  635 root       4   0  2688 2536  1944 S    2320 14.5  1.0   0:06 xterm
  254 root       3   0   944  928   640 R     816  9.1  0.3 163:38 rpc.nfsd
15150 root       1   0  1072 1072   816 R    1008  0.7  0.4   0:00 top
    1 root       0   0   600  520   472 S     472  0.0  0.2   0:17 init
    2 root       0   0     0    0     0 SW      0  0.0  0.0   0:16 kflushd
    3 root      17  17     0    0     0 SWN     0  0.0  0.0   0:00 kswapd
    4 root       0   0     0    0     0 SW      0  0.0  0.0   0:00 nfsiod
    5 root       0   0     0    0     0 SW      0  0.0  0.0   0:00 nfsiod
    6 root       0   0     0    0     0 SW      0  0.0  0.0   0:00 nfsiod
    7 root       0   0     0    0     0 SW      0  0.0  0.0   0:00 nfsiod
  650 cleomc     0   0  1672 1552  1160 S    1032  0.0  0.6   0:00 tcsh
  341 root       0   0   480  384   376 S     376  0.0  0.1   0:00 mingetty
  342 root       0   0   480  384   376 S     368  0.0  0.1   0:00 mingetty
   27 root       0   0   528  456   416 S     424  0.0  0.1   0:00 kerneld

/var/log/messages containts the standard slew of complaints:

Oct  2 14:21:57 helix01 kernel: Cannot read proc file system: 9 - Bad file descriptor.
Oct  2 14:22:27 helix01 last message repeated 155510 times
Oct  2 14:23:28 helix01 last message repeated 351761 times
Oct  2 14:24:30 helix01 last message repeated 262479 times
Oct  2 14:25:30 helix01 last message repeated 355391 times
Oct  2 14:26:31 helix01 last message repeated 377503 times
Oct  2 14:27:32 helix01 last message repeated 373464 times
Oct  2 14:28:33 helix01 last message repeated 356431 times

and so on.

I "strace -c"'d the klogd and syslogd PIDs.  Here is what they spit
out:

klogd:

write(1, "<3>Oct  2 14:29:51 kernel: Canno"..., 82) = 82
read(15913, 0x120107f84, 4096)          = -1 EBADF (Bad file descriptor)
gettimeofday({907352991, 883789}, NULL) = 0
write(1, "<3>Oct  2 14:29:51 kernel: Canno"..., 82) = 82
read(15913, 0x120107f84, 4096)          = -1 EBADF (Bad file descriptor)
gettimeofday({907352991, 886719}, NULL) = 0

etc., over and over again.  The return value of the write is always
82, and the read is always -1 EBADF.

syslogd:

gettimeofday({907353054, 104492}, NULL) = 0
gettimeofday({907353054, 104492}, NULL) = 0
gettimeofday({907353054, 105469}, NULL) = 0
gettimeofday({907353054, 105469}, NULL) = 0
select(1024, [0 3 8 9 10 11 12 13 14], NULL, NULL, NULL) = 1 (in [3])
read(3, "not read proc file system: 9 - B"..., 1024) = 1024
gettimeofday({907353054, 115235}, NULL) = 0
gettimeofday({907353054, 115235}, NULL) = 0
gettimeofday({907353054, 115235}, NULL) = 0
gettimeofday({907353054, 115235}, NULL) = 0
gettimeofday({907353054, 115235}, NULL) = 0
gettimeofday({907353054, 116211}, NULL) = 0
gettimeofday({907353054, 116211}, NULL) = 0
gettimeofday({907353054, 116211}, NULL) = 0
gettimeofday({907353054, 116211}, NULL) = 0
gettimeofday({907353054, 116211}, NULL) = 0
gettimeofday({907353054, 116211}, NULL) = 0
gettimeofday({907353054, 117188}, NULL) = 0
select(1024, [0 3 8 9 10 11 12 13 14], NULL, NULL, NULL) = 1 (in [3])
read(3, "descriptor.\0<3>Oct  2 14:30:54 "..., 1024) = 1024
gettimeofday({907353054, 118164}, NULL) = 0
gettimeofday({907353054, 118164}, NULL) = 0

etc., over and over again.  There are usually 12 (though sometimes 13)
gettimeofday messages between every select and read.

Not too surprising, I guess...

[root@helix01 /root]# amd -v
Copyright (c) 1997-1998 Erez Zadok
Copyright (c) 1990 Jan-Simon Pendry
Copyright (c) 1990 Imperial College of Science, Technology & Medicine
Copyright (c) 1990 The Regents of the University of California.
am-utils version 6.0a16 (build 1).
Built by root@spacely.redhat.com on date Tue May  5 20:11:27 EDT 1998.
cpu=alphaev5 (little-endian), arch=alpha, karch=alpha.
full_os=linux, os=linux, osver=2.0.30, vendor=unknown.
Map support for: root, passwd, union, ndbm, file, error.
AMFS: nfs, link, nfsx, nfsl, host, linkx, program, union, inherit, 
      ufs, cdfs, pcfs, auto, direct, toplvl, error.
FS: isofs, nfs, vfat, ext2.
Network: wire="npb2-net.phys.ufl.edu" (netnumber=128.227.89).


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-02 19:30 runaway klogd/syslogd happening now Craig P Prescott
@ 1998-10-02 22:39 ` Uncle George
  1998-10-03  0:02   ` Craig P Prescott
  1998-10-03  3:00 ` Paul Tomblin
  1 sibling, 1 reply; 31+ messages in thread
From: Uncle George @ 1998-10-02 22:39 UTC (permalink / raw)
  To: axp-list

does this happen often enough? Something seems to trash the channel #, and i supect a
memory overrun somewhere. In reality there shoule be a syslogd/klogd with the -g and -O0
compiled, have it crash with a fatal signal at the point that the bogus chan is detected.
u wanna be a guinnea pig  --- and more to the point, what state will be NUKED, if i screw
up the debugging session   ;-))))))) ( hackensack N.J.?  - from Superman )
is it redhat 5.0, or 5.1

u might as well as restart the daemons - as there it happens randomly, and a trap has to
be set. it does happen randomly???

gat


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-02 22:39 ` Uncle George
@ 1998-10-03  0:02   ` Craig P Prescott
  0 siblings, 0 replies; 31+ messages in thread
From: Craig P Prescott @ 1998-10-03  0:02 UTC (permalink / raw)
  To: axp-list; +Cc: gatgul

>>>>> "Uncle George" == Uncle George <gatgul@voicenet.com> writes:

 > does this happen often enough? Something seems to trash the channel
 > #, and i supect a memory overrun somewhere. In reality there shoule
 > be a syslogd/klogd with the -g and -O0 compiled, have it crash with
 > a fatal signal at the point that the bogus chan is detected.  u
 > wanna be a guinnea pig --- and more to the point, what state will be
 > NUKED, if i screw up the debugging session ;-))))))) ( hackensack
 > N.J.?  - from Superman ) is it redhat 5.0, or 5.1

Thanks for the response!  Ballpark, I can usually count on one node
getting bit with this every day or two that we run.  This is often
enough to make me want to do something about it, and is at the top of
my personal list of features I'd like eradicated.  So if you are
willing to give this a whirl, so am I.  You can mail me offline with
some instructions of how to get this going.  Our systems are RH5.0,
and Hackensack sounds as good a place as any :).

 > u might as well as restart the daemons - as there it happens
 > randomly, and a trap has to be set. it does happen randomly???

Daemons are restarted.  All our nodes seem to get this problem from
time to time.  When we are running, it seems random - I can only say
that we get a node hit every couple days on average.  The likelihood
of getting hit seems pretty much the same for all our machines.  As I
said, I only run into this when running big jobs, so in that respect,
it is not random - it seems to correlate with CPU load and/or network
activity.

 > gat

Thanks a Ton,
Craig  (aka Guinea Pig)
---
Craig P Prescott                              (352) 846-3145 (Phone)
2011 New Physics Building                     (352) 392-8863 (Fax)
University of Florida, Gainesville, FL 32611  prescott@phys.ufl.edu


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
@ 1998-10-03  0:29 Greg Lindahl
  1998-10-03  0:58 ` B. James Phillippe
  0 siblings, 1 reply; 31+ messages in thread
From: Greg Lindahl @ 1998-10-03  0:29 UTC (permalink / raw)
  To: axp-list

> [root@helix01 /root]# cat /etc/redhat-release 
> release 5.0 (Hurricane)
> [root@helix01 /root]# cat /proc/sys/kernel/file-max
> 1024
> [root@helix01 /root]# cat /proc/sys/kernel/file-nr
> 320
> [root@helix01 /root]# cat /proc/sys/kernel/inode-max 
> 3072
> [root@helix01 /root]# cat /proc/sys/kernel/inode-nr 
> 920     665

Thanks much. This proves that it's some process-local problem.

> 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.

I would forward this to bugs@redhat.com, except of course they don't
allow submission of bugs by email anymore. So I guess I'm supposed to
paste a few hundred lines of complaint into a web form or something.
Heck, maybe I'll just mail it to the right person and bypass their
bug-tracking system... In any case, I will report it.

Thanks much for your report. It is good to see that you have carefully
read the previous discussions and you provided every single bit of
possible useful information that was ever asked. An excellent job.

-- g


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-03  0:29 Greg Lindahl
@ 1998-10-03  0:58 ` B. James Phillippe
  1998-10-05  6:11   ` Craig P Prescott
  0 siblings, 1 reply; 31+ messages in thread
From: B. James Phillippe @ 1998-10-03  0:58 UTC (permalink / raw)
  To: axp-list

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 :)


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-02 19:30 runaway klogd/syslogd happening now Craig P Prescott
  1998-10-02 22:39 ` Uncle George
@ 1998-10-03  3:00 ` Paul Tomblin
  1 sibling, 0 replies; 31+ messages in thread
From: Paul Tomblin @ 1998-10-03  3:00 UTC (permalink / raw)
  To: axp-list

Quoting Craig P Prescott (prescott@phys.ufl.edu):
> Enclosed below is some info which may be helpful.  These are 5.0 boxes
> running kernel 2.0.32 with patches.  I know the kernel version is

I was getting it about once every two or three days on my one and only Alpha.
Then I stopped running syslog for a while (and worried like hell about what
was happening to my system), and then I started syslog to a separate box, and
got a 39 day uptime (until a lightning storm forced me to shut down).  But
after the storm, after 11 days I got the run-away even with remote logging.
Last weekend I upgraded my system to RedHat 5.1 (thanks to the Cable Modem an
FTP upgrade takes less time than a CD-ROM upgrade used to).  I've been running
for 6 days without a runaway, and (knock wood) I'm hoping that's it.

-- 
Paul Tomblin, ptomblin@xcski.com.
"and by God I *KNOW* what this network is for, and you can't have it."
 - Russ Allbery draws a line in the sand for Usenet.
 (http://www.xnet.com/~raven/Sysadmin/Rant.html)


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
@ 1998-10-03  7:12 Shane Steven Sturrock
  0 siblings, 0 replies; 31+ messages in thread
From: Shane Steven Sturrock @ 1998-10-03  7:12 UTC (permalink / raw)
  To: axp-list

Paul Tomblin wrote:

> Last weekend I upgraded my system to RedHat 5.1 (thanks to the Cable Modem an
> FTP upgrade takes less time than a CD-ROM upgrade used to).  I've been running
> for 6 days without a runaway, and (knock wood) I'm hoping that's it.

Don't bet on it.  My 164SX ground to a halt with the syslogd runaway and I am
running RH5.1 with all the updates.  I didn't have the presence of mind at the
time to get the necessary info together about what was going on but the next
time it happens I will have a poke about before I shut the thing down.  Its
running now after a reboot.  The machine had been up for 37 days before the bug
hit.  Looks like its not just SXs that get this either...... :-(

Shane

--
Dr. Shane Sturrock - sss@holyrood.ed.ac.uk
kernel: Calibrating delay loop.. ok - 529.53 BogoMIPS
Mmmmmmmmmmm :-)


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
@ 1998-10-03 15:03 David Levine
  0 siblings, 0 replies; 31+ messages in thread
From: David Levine @ 1998-10-03 15:03 UTC (permalink / raw)
  To: axp-list

Shane Steven Sturrock writes:

> Paul Tomblin wrote:
>
> > Last weekend I upgraded my system to RedHat 5.1 (thanks to the Cable Modem
> an
> > FTP upgrade takes less time than a CD-ROM upgrade used to).  I've been runn
> ing
> > for 6 days without a runaway, and (knock wood) I'm hoping that's it.
>
> Don't bet on it.  My 164SX ground to a halt with the syslogd runaway and I am
> running RH5.1 with all the updates.

Ditto.  I tried RH 5.1 both with and without updates, but
still hit the problem.

I avoid the problem but not running any of my threaded
applications.

I'm still looking for glibc 2.0.7-7 :-/

Thanks,
David


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
       [not found] <199810030609.CAA23387@neptune.phys.ufl.edu>
@ 1998-10-04 13:41 ` Uncle George
  0 siblings, 0 replies; 31+ messages in thread
From: Uncle George @ 1998-10-04 13:41 UTC (permalink / raw)
  To: Craig P Prescott; +Cc: axp-list@redhat.com

there seems to be 3 camps for analysizing this problem

1) upgrade to 5.1, and for some ( by virtue of the silence ) the problem
has gone away ( maybe - as the deveilish peggy bundy would say ).

2) it is a syslogd-only problem, with the most recent theory that the # of
sys chans are exhausted

3) klogd is annoying the hell outta syslogd ( which seems to be prevalent
to 5.0 folks )

In ur klogd/syslogd pair, it is easier to dump the contents of the kmsg
buffer ( about 4k ) and the line buffer ( about 1k ) when the problem
occures - utherwise u have to sit there and wait for a break on the
klogd/bad channel condition.
if u wish to wait, ( I wouldn't )  then just attach klogd, put a
breakpoint on the place that gave the bad chan message, and observe what
the kernel gave back in the kmsg buffer, or see whats in the line message
buffer ( sorry about being vague about the variable names ) It then should
be evident as to who is behaving badly. with 13 systems, thats a lotta
watching.

I always like to set a trap for random problems, where u dump key pieces
of info only when the trap is set off. u dont always get this right, as
the problem can be something quite different ( ie expecting a squirrel to
show, but instead u find a gopher with the similar feeding habbits )

so what would u like to do
gat

BTW can u also rebuild the kernel? ifs its a kernel/alpha prob then it has
to be tested there.


Craig P Prescott wrote:

> Hi;
>
> Are you still game for a debugging session?  I ask because you may be
> satisfied with Greg Lindahl's reply.  If you are, I understand
> completely, and I thank you for your reply.
>
> If you still want to make a run at it, then so am I.  I'm prepared to
> replace the klogds and syslogds on all the machines with versions with
> symbol table info and run them under gdb if that's what it takes.
> Perhaps this is not what you have in mind, though.  I'm quite
> experienced at debugging fortran codes with dbx (mostly what I work
> with), and I'm alright with c I guess, but I'm pretty inexperienced
> with gdb - I don't think that is a big issue as I have plenty of
> local resources, and it is high time I learned it anyhow.
>
> But if that is the idea, I can certainly rebuild the loggers, run
> them, and send you a traceback when they crap out, and poke around a
> bit.  I am not sure how to force generation of the fatal signals,
> though.
>




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
@ 1998-10-04 14:39 Greg Lindahl
  0 siblings, 0 replies; 31+ messages in thread
From: Greg Lindahl @ 1998-10-04 14:39 UTC (permalink / raw)
  To: axp-list

> 3) klogd is annoying the hell outta syslogd ( which seems to be prevalent
> to 5.0 folks )

This theory is proven by the strace posted before. What we don't know
yet is why klogd is reading off the wrong fd. However, it's easy to
work around it, since klogd only opens one file... and indeed, if you
could detect where the fd variable is being corrupted (by checking it
frequently), that could tell you what was causing the corruption.

-- g


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
@ 1998-10-04 21:20 Greg Lindahl
  1998-10-04 21:48 ` B. James Phillippe
  1998-10-04 23:24 ` Uncle George
  0 siblings, 2 replies; 31+ messages in thread
From: Greg Lindahl @ 1998-10-04 21:20 UTC (permalink / raw)
  To: axp-list

> 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?

Except:

1) People say that there are no kernel errors unterminated by a
newline (other than ones which are quickly followed by one that does
have a newline), and

2) There is a patch for klogd which fixes the buffer overflow that
would result from a repeated kernel message sans newline, and that
klogd patch does not fix the overall problem.

For #2 I am not sure I am remembering things right, but I'd swear that
there was a new klogd rpm issued for rh 5.1 specifically for that
particular buffer overflow problem.

-- g


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-04 21:20 Greg Lindahl
@ 1998-10-04 21:48 ` B. James Phillippe
  1998-10-04 23:24 ` Uncle George
  1 sibling, 0 replies; 31+ messages in thread
From: B. James Phillippe @ 1998-10-04 21:48 UTC (permalink / raw)
  To: axp-list

On Sun, 4 Oct 1998, Greg Lindahl wrote:

> > 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?
> 
> Except:

[reasonable-sounding exceptions deleted]

Can anyone here tell me if they're seeing this problem with a 2.1 kernel?

-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 :)


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-04 21:20 Greg Lindahl
  1998-10-04 21:48 ` B. James Phillippe
@ 1998-10-04 23:24 ` Uncle George
  1 sibling, 0 replies; 31+ messages in thread
From: Uncle George @ 1998-10-04 23:24 UTC (permalink / raw)
  To: axp-list

i see nothing diff'rnt in the rawhide version, and ( i think) the 5.1 version
that i used to debug klogd&syslogd

Greg Lindahl wrote:

> Except:
> 2) There is a patch for klogd which fixes the buffer overflow that
> would result from a repeated kernel message sans newline, and that
> klogd patch does not fix the overall problem.
>
> For #2 I am not sure I am remembering things right, but I'd swear that
> there was a new klogd rpm issued for rh 5.1 specifically for that
> particular buffer overflow problem.




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-03  0:58 ` B. James Phillippe
@ 1998-10-05  6:11   ` Craig P Prescott
  0 siblings, 0 replies; 31+ messages in thread
From: Craig P Prescott @ 1998-10-05  6:11 UTC (permalink / raw)
  To: axp-list

>>>>> "bp" == B James Phillippe <bryan@terran.org> writes:

> 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?

[root@helix01 /root]# cat /proc/kmsg 
<sc 49(140f3bc70,40,8)>

(there is no newline on the end, and I Ctrl-c'd to get out of cat).

Is this good/bad/normal?

Thanks,
Craig
---
Craig P Prescott                              (352) 846-3145 (Phone)
2011 New Physics Building                     (352) 392-8863 (Fax)
University of Florida, Gainesville, FL 32611  prescott@phys.ufl.edu


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
@ 1998-10-05 21:24 Greg Lindahl
  1998-10-06  0:09 ` Uncle George
  0 siblings, 1 reply; 31+ messages in thread
From: Greg Lindahl @ 1998-10-05 21:24 UTC (permalink / raw)
  To: axp-list

> [root@helix01 /root]# cat /proc/kmsg 
> <sc 49(140f3bc70,40,8)>

Hm, that's right, unimplemented system calls do not have newlines
after them. So if there were enough, that would cause memory
corruption downstream in syslogd.

So let's make a patch for syslogd which inserts a newline if
the buffer is growing too close to the limit.

-- g


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-05 21:24 Greg Lindahl
@ 1998-10-06  0:09 ` Uncle George
  1998-10-06  0:27   ` Barrett G. Lyon
                     ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Uncle George @ 1998-10-06  0:09 UTC (permalink / raw)
  To: axp-list

actually its klogd that reads kern messages, like the one u posted.

its probably better to fix the kern messages. after all, the 386 guys
arent complaining are they?

Greg Lindahl wrote:

> > [root@helix01 /root]# cat /proc/kmsg
> > <sc 49(140f3bc70,40,8)>
>
> Hm, that's right, unimplemented system calls do not have newlines
> after them. So if there were enough, that would cause memory
> corruption downstream in syslogd.
>
> So let's make a patch for syslogd which inserts a newline if
> the buffer is growing too close to the limit.
>
> -- g
>
> --
> To unsubscribe: send e-mail to axp-list-request@redhat.com with
> 'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-06  0:09 ` Uncle George
@ 1998-10-06  0:27   ` Barrett G. Lyon
  1998-10-06  0:46     ` Uncle George
  1998-10-06  7:12   ` Michal Jaegermann
  1998-10-06 22:09   ` Jeff Sturm
  2 siblings, 1 reply; 31+ messages in thread
From: Barrett G. Lyon @ 1998-10-06  0:27 UTC (permalink / raw)
  To: axp-list


I'll have a working patch done for klogd by this weekend.  I was reading
the threads, and I was just gonna patch klogd to do the \n if it hits a set
limit.

If someone has a good idea of the buffer limit to start the \n at, let me
know.

At 08:09 PM 10/5/98 -0400, you wrote:
>actually its klogd that reads kern messages, like the one u posted.
>
>its probably better to fix the kern messages. after all, the 386 guys
>arent complaining are they?
>
>Greg Lindahl wrote:
>
>> > [root@helix01 /root]# cat /proc/kmsg
>> > <sc 49(140f3bc70,40,8)>
>>
>> Hm, that's right, unimplemented system calls do not have newlines
>> after them. So if there were enough, that would cause memory
>> corruption downstream in syslogd.
>>
>> So let's make a patch for syslogd which inserts a newline if
>> the buffer is growing too close to the limit.
>>
>> -- g
>>
>> --
>> To unsubscribe: send e-mail to axp-list-request@redhat.com with
>> 'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com
>
>
>
>-- 
>To unsubscribe: send e-mail to axp-list-request@redhat.com with
>'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com
>
>

--
Barrett G. Lyon                               PGP Key: http://www.doxx.net/pgp
Data & Network Security Consultant                Fax: 310-737-0196
Network Presence, LLC                           Email: blyon@netpr.com
--


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-06  0:46     ` Uncle George
@ 1998-10-06  0:45       ` Barrett G. Lyon
  0 siblings, 0 replies; 31+ messages in thread
From: Barrett G. Lyon @ 1998-10-06  0:45 UTC (permalink / raw)
  To: axp-list



Well I was thinking about submit'n it to er.. myself.  :)  Then this list,
kuz I hate my box crashing, and I am sure the others here do too.  Maybe if
it actually works, Redhat might wanna take a look... but as long as it gets
my stuff working I will be happy.

-Barrett

At 08:46 PM 10/5/98 -0400, you wrote:
>thats neat, but who  u gonna submit it to? the web/email address for the last
>maintainer doesn't seem to exist.
>
>Barrett G. Lyon wrote:
>
>> I'll have a working patch done for klogd by this weekend.  I was reading
>> the threads, and I was just gonna patch klogd to do the \n if it hits a set
>> limit.
>
>
>
>-- 
>To unsubscribe: send e-mail to axp-list-request@redhat.com with
>'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com
>
>

--
Barrett G. Lyon                               PGP Key: http://www.doxx.net/pgp
Data & Network Security Consultant                Fax: 310-737-0196
Network Presence, LLC                           Email: blyon@netpr.com
--


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-06  0:27   ` Barrett G. Lyon
@ 1998-10-06  0:46     ` Uncle George
  1998-10-06  0:45       ` Barrett G. Lyon
  0 siblings, 1 reply; 31+ messages in thread
From: Uncle George @ 1998-10-06  0:46 UTC (permalink / raw)
  To: axp-list

thats neat, but who  u gonna submit it to? the web/email address for the last
maintainer doesn't seem to exist.

Barrett G. Lyon wrote:

> I'll have a working patch done for klogd by this weekend.  I was reading
> the threads, and I was just gonna patch klogd to do the \n if it hits a set
> limit.




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-06  0:09 ` Uncle George
  1998-10-06  0:27   ` Barrett G. Lyon
@ 1998-10-06  7:12   ` Michal Jaegermann
  1998-10-06 12:12     ` Craig P Prescott
  1998-10-06 22:09   ` Jeff Sturm
  2 siblings, 1 reply; 31+ messages in thread
From: Michal Jaegermann @ 1998-10-06  7:12 UTC (permalink / raw)
  To: axp-list

Uncle George wrote:
> 
> actually its klogd that reads kern messages, like the one u posted.
> 
> its probably better to fix the kern messages.

Patches which Jay announced for 2.0.35 (and things which I hacked
based on that for an upcoming 2.0.36) actually add missing
newline.  It is in arch/alpha/kernel/traps.c.

  --mj


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-06  7:12   ` Michal Jaegermann
@ 1998-10-06 12:12     ` Craig P Prescott
  0 siblings, 0 replies; 31+ messages in thread
From: Craig P Prescott @ 1998-10-06 12:12 UTC (permalink / raw)
  To: axp-list

>>>>> "mj" == Michal Jaegermann <michal@ellpspace.math.ualberta.ca> writes:

    mj> Uncle George wrote:
    >>  actually its klogd that reads kern messages, like the one u
    >> posted.
    >> 
    >> its probably better to fix the kern messages.

    mj> Patches which Jay announced for 2.0.35 (and things which I
    mj> hacked based on that for an upcoming 2.0.36) actually add
    mj> missing newline.  It is in arch/alpha/kernel/traps.c.

    mj>   --mj

Cool.  On a related note, I noticed tonight that klogd silently dies
(syslogd remains alive) more frequently than we get the syslogd/klogd
runaway problem - I just never noticed.  From previous discussions I
don't recall "death of klogd" as documented behavior.  Is this known
behavior?  Seems that klogd goes away whenever the contents of
/proc/kmsg hits 8192 bytes.(?)

[root@helix07 tmp]# ps aux | grep klogd
root     12873  0.0  0.4  2120   560  p2 D   15:38   0:00 grep klogd 
[root@helix07 tmp]# head -1 /var/run/klogd.pid
165
[root@helix07 tmp]# ps aux | grep 165
root     12889  0.0  0.4  2184   608  p2 S   15:46   0:00 grep 165 
[root@helix07 tmp]# ps aux | grep syslog
root       156  0.0  0.2  7464   336  ?  S  Oct  5   0:04 syslogd 
root     12899  0.0  0.0   192    24  p2 R   15:47   0:00 grep syslog 
[root@helix07 tmp]# cat /proc/kmsg > kmsg.log
^C
[root@helix07 tmp]# wc kmsg.log 
      5     395    8192 kmsg.log

About 10 machines were as above.  There was no evidence in
/var/log/messages that klogd had left the building.  The contents of
kmsg.log from above are at the end of this note - you can see that
almost all of this stuff comes from do_entSys in traps.c (at least it
is the only printk("<sc...") in the kernel).

I'm not sure what to make of this - I know nothing of sysklogd (or
linux) innards, but I'm learning.  Is it normal that /proc/kmsg can
get to 8 Kbytes?  If all the newlines get put in like they should,
will klogd still die if /proc/kmsg gets too big?  I guess this is
easily testable.  Are death and runaway both reasonable results of
trashing the stack?

All this probably explains the unexpectedly low frequency of
syslogd/klogd runaways I've seen since my original post - haven't had
a runaway in the last few days on any machine - most of my klogd
processes were dead before they could go bananas.  This fits the
hypothesis that syslogd doesn't get mad if klogd is not bugging it.

Cheers,
Craig
---
Craig P Prescott                              (352) 846-3145 (Phone)
2011 New Physics Building                     (352) 392-8863 (Fax)
University of Florida, Gainesville, FL 32611  prescott@phys.ufl.edu

[root@helix07 tmp]# cat kmsg.log
0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f320a0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,!
!
40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)>NFS server helix06 not responding, still trying.
<4>NFS server helix06 OK.
<4><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f30cd0,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)!
!
><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f2d470,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><!
!
sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc!
!
 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)>EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
<2>EXT2-fs error (device 08:11): ext2_check_blocks_bitmap: Wrong free blocks count for group 487, stored = 0, counted = 216
<2>EXT2-fs error (device 08:11): ext2_check_blocks_bitmap: Wrong free blocks count in super block, stored = 6741676, counted = 6741892
<4><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)!
!
><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><!
!
sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc!
!
 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)><sc 49(140f3bc70,40,8)>


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
@ 1998-10-06 13:15 Greg Lindahl
  1998-10-06 13:26 ` Barrett G. Lyon
  1998-10-06 15:31 ` Michal Jaegermann
  0 siblings, 2 replies; 31+ messages in thread
From: Greg Lindahl @ 1998-10-06 13:15 UTC (permalink / raw)
  To: axp-list

> > actually its klogd that reads kern messages, like the one u posted.
> > 
> > its probably better to fix the kern messages.
> 
> Patches which Jay announced for 2.0.35 (and things which I hacked
> based on that for an upcoming 2.0.36) actually add missing
> newline.  It is in arch/alpha/kernel/traps.c.

It's fine to fix the kernel, which will paper over the other bugs, but
it would be good to fix the other bugs too. We know that syslogd also
has a bug because it is reading a bogus fd.

As for what buffer size to insert the \n at, how about the length of
the buffer you're reading into minus one?

-- g


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-06 13:15 Greg Lindahl
@ 1998-10-06 13:26 ` Barrett G. Lyon
  1998-10-06 15:31 ` Michal Jaegermann
  1 sibling, 0 replies; 31+ messages in thread
From: Barrett G. Lyon @ 1998-10-06 13:26 UTC (permalink / raw)
  To: axp-list

At 09:15 AM 10/6/98 -0400, you wrote:
>> > actually its klogd that reads kern messages, like the one u posted.
>> > 
>> > its probably better to fix the kern messages.
>> 
>> Patches which Jay announced for 2.0.35 (and things which I hacked
>> based on that for an upcoming 2.0.36) actually add missing
>> newline.  It is in arch/alpha/kernel/traps.c.
>
>It's fine to fix the kernel, which will paper over the other bugs, but
>it would be good to fix the other bugs too. We know that syslogd also
>has a bug because it is reading a bogus fd.
>

Maybe syslogd can't read the /proc file system and in a result is reporting
the bogus fd problem?  Maybe the fd/syslogd problem is also related to the
bugs in klogd.

I'm moving slow on my changes to klogd, does anyone have any patch or
sample code/ideas to fix this?  My Alpha machine is crashing daily on
2.0.35, and I would love to know if kmesgd/syslogd is the problem, yet I
can't do remote logging/or just shut off logging. 

BTW:  I'm glad this is FINALLY figured out to the point where the problems
are known!!  After this is all over and I have a stable 21164sx w/linux
there will be a party at my place!  :)

 



--
Barrett G. Lyon                               PGP Key: http://www.doxx.net/pgp
Data & Network Security Consultant                Fax: 310-737-0196
Network Presence, LLC                           Email: blyon@netpr.com
--


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-06 13:15 Greg Lindahl
  1998-10-06 13:26 ` Barrett G. Lyon
@ 1998-10-06 15:31 ` Michal Jaegermann
  1 sibling, 0 replies; 31+ messages in thread
From: Michal Jaegermann @ 1998-10-06 15:31 UTC (permalink / raw)
  To: axp-list

Greg Lindahl wrote:
> 
> It's fine to fix the kernel, which will paper over the other bugs, but
> it would be good to fix the other bugs too. We know that syslogd also
> has a bug because it is reading a bogus fd.

No, actually we don't (unless this is a lack of a guard against
a buffer overflow somewhere where there is no way to control input
data).  If you will trash a stack than any outcome is possible
including,  obviously, killing a process as reported in another posting.
Actually, one would think, that the later is more likely result.

I did not analyze the bug in depth; indeed, I was not even struck by an
instance of it.  Luck of a draw, I guess, or I do not run anything that
would cause an avalanche of invocations of unimplemented system calls
(if this is indeed a reason).  But it **might** be that adding this
missing terminator is a proper fix.

> As for what buffer size to insert the \n at, how about the length of
> the buffer you're reading into minus one?

What about it?  If some reasonable constraints are violated then
problems may show up.  This is an abstract discussion.  At this stage
we need to see some code, I guess.

  Michal


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
@ 1998-10-06 15:44 Greg Lindahl
  0 siblings, 0 replies; 31+ messages in thread
From: Greg Lindahl @ 1998-10-06 15:44 UTC (permalink / raw)
  To: axp-list

> Maybe syslogd can't read the /proc file system and in a result is reporting
> the bogus fd problem?

Why say "maybe"? The strace posted earlier makes it clear that syslogd
is printing that error because it is trying to read from a bogus fd
number. Somehow it got overwritten. That somehow could revolve around
long messages.

> I'm moving slow on my changes to klogd, does anyone have any patch or
> sample code/ideas to fix this?  My Alpha machine is crashing daily on
> 2.0.35,

Exactly how did you build 2.0.35? No one else has reported that level
of problem. If you look through the archive of this list you will find
instructions on how to take vanilla 2.0.35 and apply the 2.0.34 axp
patch to it. I'm running 67 machines with 2.0.35 and have never gotten
a mysterious crash.

> and I would love to know if kmesgd/syslogd is the problem,

No one else has ever reported a crash from the klogd/syslogd problem,
just high cpu consumption.

-- g


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
@ 1998-10-06 15:47 Greg Lindahl
  1998-10-06 16:05 ` Michal Jaegermann
  1998-10-06 19:53 ` Quant-X Alpha Linux Support
  0 siblings, 2 replies; 31+ messages in thread
From: Greg Lindahl @ 1998-10-06 15:47 UTC (permalink / raw)
  To: axp-list

> > It's fine to fix the kernel, which will paper over the other bugs, but
> > it would be good to fix the other bugs too. We know that syslogd also
> > has a bug because it is reading a bogus fd.
> 
> No, actually we don't (unless this is a lack of a guard against
> a buffer overflow somewhere where there is no way to control input
> data).

If syslogd doesn't have a bug, why is it reading from a fd which is
too large? It must have a bug.

> I did not analyze the bug in depth; indeed, I was not even struck by an
> instance of it.

You can probably generate it by just intentionally making a lot of
unimplemented system calls. Remember that folks are reporting that
under unknown circumstances, normal binaries start producing lots of
those messages about unimplemented system calls.

-- g


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-06 15:47 Greg Lindahl
@ 1998-10-06 16:05 ` Michal Jaegermann
  1998-10-06 19:53 ` Quant-X Alpha Linux Support
  1 sibling, 0 replies; 31+ messages in thread
From: Michal Jaegermann @ 1998-10-06 16:05 UTC (permalink / raw)
  To: axp-list

Greg Lindahl wrote:
> 
> > 
> > No, actually we don't (unless this is a lack of a guard against
> > a buffer overflow somewhere where there is no way to control input
> > data).
> 
> If syslogd doesn't have a bug, why is it reading from a fd which is
> too large? It must have a bug.

Most likely local variables on stack were clobbered with a garbage
because of a buffer overflow.  This will create all kind of funny values
and side-effects.  This is a guess, but educated one. :-)

If something assumes that its input satisfies some constraints, and
this input cannot be influenced by a user, then this assumption
is reasonable.  When "producers" stop conforming then all bets are off.
Of course this is a bug but you are free to interpret on which side
of an interface and what is the simplest fix.

  --mj


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-06 15:47 Greg Lindahl
  1998-10-06 16:05 ` Michal Jaegermann
@ 1998-10-06 19:53 ` Quant-X Alpha Linux Support
  1 sibling, 0 replies; 31+ messages in thread
From: Quant-X Alpha Linux Support @ 1998-10-06 19:53 UTC (permalink / raw)
  To: axp-list

Hi Greg !

> If syslogd doesn't have a bug, why is it reading from a fd which is
> too large? It must have a bug.
> 
> > I did not analyze the bug in depth; indeed, I was not even struck by an
> > instance of it.
> 
> You can probably generate it by just intentionally making a lot of
> unimplemented system calls. Remember that folks are reporting that
> under unknown circumstances, normal binaries start producing lots of
> those messages about unimplemented system calls.

I bet you mean only the locale bug. Here related stuff out of my
.bashrc

# to avoid "unimplemented OSF mmap flags 0402" for AXP/Linux
if ! uname -m|grep -q alpha  ; then
  LANG=de_DE.ISO8859-1
  LC_NUMERIC=de_DE.ISO8859-1
  LC_MONETARY=de_DE.ISO8859-1
  LC_TIME=de_DE.ISO8859-1
  LC_MESSAGES=de_DE.ISO8859-1
  LC_COLLATE=de_DE.ISO8859-1
  LC_CTYPE=de_DE.ISO8859-1
  LC_ALL=
  export LANG LC_NUMERIC LC_MONETARY LC_TIME LC_MESSAGES
  export LC_COLLATE LC_TYPE LC_ALL
else
  unset LANG LC_NUMERIC LC_MONETARY LC_TIME LC_MESSAGES
  unset LC_COLLATE LC_TYPE LC_ALL
fi


  ciao -
    Stefan

-- 

Quant-X Service &                         Ph:  (+43) 4212 6004-0
Consulting Ges.m.b.H.                     Fax: (+43) 4212 600420
http://www.quant-x.com                    Email: support@quant-x.com


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-06  0:09 ` Uncle George
  1998-10-06  0:27   ` Barrett G. Lyon
  1998-10-06  7:12   ` Michal Jaegermann
@ 1998-10-06 22:09   ` Jeff Sturm
  1998-10-06 22:52     ` Peter Waltenberg
  1998-10-07 10:22     ` Uncle George
  2 siblings, 2 replies; 31+ messages in thread
From: Jeff Sturm @ 1998-10-06 22:09 UTC (permalink / raw)
  To: Uncle George; +Cc: axp-list


I've been following this discussion for awhile... I'm curious why there 
hasn't been any discussion of the klogd source since it is so little.  My 
SX has never experienced the klogd runaway so I can't easily debug the 
problem, but a quick read through reveals problems in klogd.c:

static void LogLine(char *ptr, int len)
{
    auto int idx = 0;
    static int index = 0;
    auto char *nl;
    static char line[LOG_LINE_LENGTH],
                eline[LOG_LINE_LENGTH];

    ...

    while (len) {
        nl = strpbrk(ptr, "\r\n"); /* Find first line terminator */
        if (nl) {
             ...
        }
        else
        {
            strncat(line, ptr, len);
            index += len;
            len = 0;
        }
    }
    return;
}

Clearly there is a buffer overrun if the input buffer exceeds 
LOG_LINE_LENGTH (1024 bytes).  Also the strpbrk call is dangerous, since 
the input buffer may not be terminated.

Fixing this in the kernel is a good idea, but klogd must be fixed too before
this happens again someday... (Why doesn't this bug affect Intel users?  
Have they never had a kernel that can generate /proc/kmsg messages longer 
than 1024 bytes?)

Is anybody patching this?  It can't be difficult, but I won't have a chance 
until sometime tomorrow...

Jeff

On Mon, 5 Oct 1998, Uncle George wrote:
> actually its klogd that reads kern messages, like the one u posted.
> 
> its probably better to fix the kern messages. after all, the 386 guys
> arent complaining are they?
> 
> Greg Lindahl wrote:
> 
> > > [root@helix01 /root]# cat /proc/kmsg
> > > <sc 49(140f3bc70,40,8)>
> >
> > Hm, that's right, unimplemented system calls do not have newlines
> > after them. So if there were enough, that would cause memory
> > corruption downstream in syslogd.
> >
> > So let's make a patch for syslogd which inserts a newline if
> > the buffer is growing too close to the limit.
> >
> > -- g


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-06 22:09   ` Jeff Sturm
@ 1998-10-06 22:52     ` Peter Waltenberg
  1998-10-07 10:22     ` Uncle George
  1 sibling, 0 replies; 31+ messages in thread
From: Peter Waltenberg @ 1998-10-06 22:52 UTC (permalink / raw)
  To: axp-list; +Cc: Uncle George


On 06-Oct-98 Jeff Sturm wrote:
> 
> I've been following this discussion for awhile... I'm curious why there 
> hasn't been any discussion of the klogd source since it is so little.  My 
> SX has never experienced the klogd runaway so I can't easily debug the 
> problem, but a quick read through reveals problems in klogd.c:
> 
> static void LogLine(char *ptr, int len)
> {
>     auto int idx = 0;
>     static int index = 0;
>     auto char *nl;
>     static char line[LOG_LINE_LENGTH],
>                 eline[LOG_LINE_LENGTH];
> 
>     ...
> 
>     while (len) {
>         nl = strpbrk(ptr, "\r\n"); /* Find first line terminator */
>         if (nl) {
>              ...
>         }
>         else
>         {
>             strncat(line, ptr, len);
>             index += len;
>             len = 0;
>         }
>     }
>     return;
> }
> 
> Clearly there is a buffer overrun if the input buffer exceeds 
> LOG_LINE_LENGTH (1024 bytes).  Also the strpbrk call is dangerous, since 
> the input buffer may not be terminated.
> 
> Fixing this in the kernel is a good idea, but klogd must be fixed too before
> this happens again someday... (Why doesn't this bug affect Intel users?  
> Have they never had a kernel that can generate /proc/kmsg messages longer 
> than 1024 bytes?)
> 

Fix it in klogd.
1) The kernel has suffered memory corruption, klogd gets passed a pointer to 
some random area of memory.
2) Someone supplies an inappropriate format specifier to printk, leading to a 
result akin to 1. I've done that, so I know it's possible.
3) It has happened to Intel users :), it just doesn't happen as often.

Peter
----------------------------------
E-Mail: Peter Waltenberg <peterw@dascom.com>
Date: 07-Oct-98
Time: 08:45:38

This message was sent by XFMail
----------------------------------


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: runaway klogd/syslogd happening now
  1998-10-06 22:09   ` Jeff Sturm
  1998-10-06 22:52     ` Peter Waltenberg
@ 1998-10-07 10:22     ` Uncle George
  1 sibling, 0 replies; 31+ messages in thread
From: Uncle George @ 1998-10-07 10:22 UTC (permalink / raw)
  To: Jeff Sturm; +Cc: axp-list

Generally i'd like to report this "simple" solution to the owners, and let them
best figure out how to code it..
Do u know where these guys are???. Where is the point of origin for all of ths
syslogd & klogd source ?
gat

Jeff Sturm wrote:

> I've been following this discussion for awhile... I'm curious why there
> hasn't been any discussion of the klogd source since it is so little.  My
> SX has never experienced the klogd runaway so I can't easily debug the
> problem, but a quick read through reveals problems in klogd.c:




^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~1998-10-07 10:26 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-10-02 19:30 runaway klogd/syslogd happening now Craig P Prescott
1998-10-02 22:39 ` Uncle George
1998-10-03  0:02   ` Craig P Prescott
1998-10-03  3:00 ` Paul Tomblin
  -- strict thread matches above, loose matches on Subject: below --
1998-10-03  0:29 Greg Lindahl
1998-10-03  0:58 ` B. James Phillippe
1998-10-05  6:11   ` Craig P Prescott
1998-10-03  7:12 Shane Steven Sturrock
1998-10-03 15:03 David Levine
     [not found] <199810030609.CAA23387@neptune.phys.ufl.edu>
1998-10-04 13:41 ` Uncle George
1998-10-04 14:39 Greg Lindahl
1998-10-04 21:20 Greg Lindahl
1998-10-04 21:48 ` B. James Phillippe
1998-10-04 23:24 ` Uncle George
1998-10-05 21:24 Greg Lindahl
1998-10-06  0:09 ` Uncle George
1998-10-06  0:27   ` Barrett G. Lyon
1998-10-06  0:46     ` Uncle George
1998-10-06  0:45       ` Barrett G. Lyon
1998-10-06  7:12   ` Michal Jaegermann
1998-10-06 12:12     ` Craig P Prescott
1998-10-06 22:09   ` Jeff Sturm
1998-10-06 22:52     ` Peter Waltenberg
1998-10-07 10:22     ` Uncle George
1998-10-06 13:15 Greg Lindahl
1998-10-06 13:26 ` Barrett G. Lyon
1998-10-06 15:31 ` Michal Jaegermann
1998-10-06 15:44 Greg Lindahl
1998-10-06 15:47 Greg Lindahl
1998-10-06 16:05 ` Michal Jaegermann
1998-10-06 19:53 ` Quant-X Alpha Linux Support

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox