Bug 32760 - klogd buffer overflow
klogd buffer overflow
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: kernel (Show other bugs)
6.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Arjan van de Ven
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-03-22 21:38 EST by dcivelli
Modified: 2008-08-01 12:22 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-09-30 11:38:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description dcivelli 2001-03-22 21:38:38 EST
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 05:33:32 EST
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 18:18:34 EST
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 11:38:56 EDT
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.