From nobody@FreeBSD.org  Tue Mar 19 14:26:53 2002
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 5FB6D37B404
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 19 Mar 2002 14:26:53 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id g2JMQrc36898;
	Tue, 19 Mar 2002 14:26:53 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200203192226.g2JMQrc36898@freefall.freebsd.org>
Date: Tue, 19 Mar 2002 14:26:53 -0800 (PST)
From: chris <cherbst@hotpop.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: dmesg output corrupt if /dev/console is busy
X-Send-Pr-Version: www-1.0

>Number:         36110
>Category:       bin
>Synopsis:       dmesg(8) output corrupt if /dev/console is busy
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          analyzed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 19 14:30:01 PST 2002
>Closed-Date:    
>Last-Modified:  Wed May 21 21:29:17 UTC 2008
>Originator:     chris
>Release:        4.5-RELEASE
>Organization:
>Environment:
FreeBSD testing 4.5-RELEASE FreeBSD 4.5-RELEASE #4: Mon Mar 18 13:18:54 EST 2002     chris@testing:/usr/src/sys/compile/LOCAL  i386
>Description:
     At version 4.3 dmesg -a was added, so you can see console output remotely.  If you have lots of output going to /dev/console (happened at 32k of data here) dmesg output will not be readable eventually.  The LINT file says MSGBUF_SIZE=40960, but "dmesg -a >file;du file" reports 32(k) when it is broken.  It should push out old lines and append new ones when it is full.
>How-To-Repeat:
Set up syslog to log to /dev/console, and send more than ~32k (or whatever your MSGBUF_SIZE is) of data to that facility.  Then run dmesg.  If it is corrupt, run dmesg -a, redirect to a file, and see how large the file is.  It should be about the same as MSGBUF_SIZE.
>Fix:
      Reboot to get a sane dmesg output back.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: rwatson 
State-Changed-When: Sun May 2 15:25:33 PDT 2004 
State-Changed-Why:  

This occurs because we use a single combined buffer for both kernel 
messages (normally captured in the kernel's msgbuf) and logged 
console output (/dev/console).  This results in a variety of problems, 
and would probably be best corrected by breaking out msgbuf into two 
separate buffers since their contents have different properties. 

An important security issue relating to this bug/feature can be found 
in bin/25337. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=36110 
>Unformatted:
