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