From: Peter Waltenberg <peterw@dascom.com>
To: axp-list@redhat.com
Cc: Uncle George <gatgul@voicenet.com>
Subject: Re: runaway klogd/syslogd happening now
Date: Wed, 07 Oct 1998 08:50:34 -0000=?us-ascii?Q?_(/etc/localtimep=97=12=08|=F7=FF=BF=3Dm =08?= [thread overview]
Message-ID: <XFMail.981007085034.peterw@dascom.com> (raw)
In-Reply-To: <Pine.SV4.3.90.981006175313.5272A-100000@gatecoms>
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
----------------------------------
next prev parent reply other threads:[~1998-10-06 22:52 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-10-05 21:24 runaway klogd/syslogd happening now 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 [this message]
1998-10-07 10:22 ` Uncle George
-- strict thread matches above, loose matches on Subject: below --
1998-10-06 15:47 Greg Lindahl
1998-10-06 16:05 ` Michal Jaegermann
1998-10-06 19:53 ` Quant-X Alpha Linux Support
1998-10-06 15:44 Greg Lindahl
1998-10-06 13:15 Greg Lindahl
1998-10-06 13:26 ` Barrett G. Lyon
1998-10-06 15:31 ` Michal Jaegermann
1998-10-04 21:20 Greg Lindahl
1998-10-04 21:48 ` B. James Phillippe
1998-10-04 23:24 ` Uncle George
1998-10-04 14:39 Greg Lindahl
[not found] <199810030609.CAA23387@neptune.phys.ufl.edu>
1998-10-04 13:41 ` Uncle George
1998-10-03 15:03 David Levine
1998-10-03 7:12 Shane Steven Sturrock
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-02 19:30 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
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox