Bug 32760 - klogd buffer overflow
Summary: klogd buffer overflow
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 6.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Arjan van de Ven
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-03-23 02:38 UTC by dcivelli
Modified: 2008-08-01 16:22 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-09-30 15:38:56 UTC
Embargoed:


Attachments (Terms of Use)

Description dcivelli 2001-03-23 02:38:38 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.72 [en] (X11; U; Linux 2.2.14-5.0 i686)


I wrote a new device driver as a module.
When I'm writing too many messages with printk() without giving up CPU,
klogd buffer gets overflowed and syslog starts getting part of the message,
which is written to /var/log/messages (syslog.conf is *.info
/var/log/messages).
 


Reproducible: Sometimes
Steps to Reproduce:
1.try to make printk more than 1000 time
2.type dmesg to see all the debug messages
3.type tail -f /var/log/messages to see the trunck strings of your messages

Use strace command on klogs and syslog processes to see the communication
	

Actual Results:  we get some part of debug messages in /var/log/messages

Expected Results:  The configuration for syslog is *.info /var/log/messages
so we don't have debug messages or part of debug messages in
/var/log/messages

Code of device driver:

static int short_driver_ioctl(struct inode* inode, struct file* file,
unsigned int cmd, unsigned long arg)
{
	int rc,cpt,i;
	cpt=(int) arg;
              rc=1;
	for(i=0;i<cpt;i++)
	{
		printk(KERN_DEBUG "%d: This is a long message :
********************************************************\n",i);
		/*current->state = TASK_INTERRUPTIBLE;
		schedule_timeout(1);*/
	}
	return rc;
}


Application code
#include <sys/ioctl.h>
#include <stdio.h>
#include <fcntl.h>
#include "short_driver.h"
#include <syslog.h>




int main()
{
  int m_fd;
  int value;
  int i;
  printf("Begin of driver Test \n");
  printf("Give the number of iterations you want:");
  scanf("%d",&value);
  m_fd = open("/dev/shortdriver", O_RDWR);
  ioctl(m_fd,SHORTDRIVER_TEST_CMD,value);
  printf("End of driver Test\n");
  return(0);
}


When we give up the CPU for a time, we haven't any more the problem.
In fact the problem is that klogd make to try to read all the messages in
loop in only one time, and its buffer (4096) gets overflows. (See with
strace -p pid_klogd)


Thank for help.

Comment 1 Arjan van de Ven 2001-03-23 10:33:32 UTC
The kernel has a limited, fixed sized buffer for storing messages until klogd
picks them up. This is done to prevent a while (1) printk("foobar"); from
eating all kernel-memory. This is not a BUG but a feature/safety precaution.

Comment 2 dcivelli 2001-03-23 23:18:34 UTC
I understand that the kernel buffer has a fixed size.  What I don't understand,
is why part of the message is written to /var/log/messages.   klogd seems to
change the error level from <7> to <6> when the buffer overflows and write a
part of the buffer.  This basically pollutes /var/log/messages with
unintelligible messages.  It would be much more clear to write a message to
/var/log/messages indicating the kernel print buffer overflow.

Comment 3 Bugzilla owner 2004-09-30 15:38:56 UTC
Thanks for the bug report. However, Red Hat no longer maintains this version of
the product. Please upgrade to the latest version and open a new bug if the problem
persists.

The Fedora Legacy project (http://fedoralegacy.org/) maintains some older releases, 
and if you believe this bug is interesting to them, please report the problem in
the bug tracker at: http://bugzilla.fedora.us/



Note You need to log in before you can comment on or make changes to this bug.