From Jim.Pirzyk@disney.com  Tue May  8 14:39:36 2001
Return-Path: <Jim.Pirzyk@disney.com>
Received: from mail.disney.com (mail.disney.com [204.128.192.15])
	by hub.freebsd.org (Postfix) with ESMTP id 0E86437B42C
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  8 May 2001 14:39:36 -0700 (PDT)
	(envelope-from Jim.Pirzyk@disney.com)
Received: from pain10.corp.disney.com (root@pain10.corp.disney.com [153.7.110.100])
	by mail.disney.com (Switch-2.0.1/Switch-2.0.1) with SMTP id f48LcxA11129
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 8 May 2001 14:38:59 -0700 (PDT)
Received: from louie.fa.disney.com by pain.corp.disney.com with ESMTP for FreeBSD-gnats-submit@freebsd.org; Tue, 8 May 2001 14:40:16 -0700
Received: from plio.fan.fa.disney.com (plio.fan.fa.disney.com [153.7.118.2])
	by louie.fa.disney.com (8.9.2/8.9.2) with ESMTP id OAA13105
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 8 May 2001 14:39:29 -0700 (PDT)
	(envelope-from Jim.Pirzyk@fa.disney.com)
Received: from snoopy.fan.fa.disney.com (snoopy.fan.fa.disney.com [153.7.117.170])
	by plio.fan.fa.disney.com (8.9.2/8.9.2) with ESMTP id OAA08523
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 8 May 2001 14:39:28 -0700 (PDT)
	(envelope-from Jim.Pirzyk@fa.disney.com)
Received: (from Jim.Pirzyk@localhost)
	by snoopy.fan.fa.disney.com (8.11.3/8.9.3) id f48LdSM23731;
	Tue, 8 May 2001 14:39:28 -0700 (PDT)
	(envelope-from Jim.Pirzyk@fa.disney.com)
Message-Id: <200105082139.f48LdSM23731@snoopy.fan.fa.disney.com>
Date: Tue, 8 May 2001 14:39:28 -0700 (PDT)
From: Jim.Pirzyk@disney.com
Reply-To: Jim.Pirzyk@disney.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: /compat/linux/proc/stat has overflows
X-Send-Pr-Version: 3.113

>Number:         27215
>Category:       kern
>Synopsis:       when cat'ing /compat/linux/proc/stat, we have negative numbers
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    des
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 08 14:40:01 PDT 2001
>Closed-Date:    Sat Jun 9 09:02:36 PDT 2001
>Last-Modified:  Sat Jun 09 09:02:47 PDT 2001
>Originator:     Jim Pirzyk
>Release:        FreeBSD 4.3-RELEASE i386
>Organization:
>Environment:
System: FreeBSD snoopy.fan.fa.disney.com 4.3-RELEASE FreeBSD 4.3-RELEASE #4: Fri Apr 27 01:14:59 PDT 2001 root@snoopy.fan.fa.disney.com:/auto/roy/dist/pub/FreeBSD/4.3-RELEASE/sys/compile/UP_WORKSTATION i386

	linprocfs kernel module.

>Description:
	cat'ing /compat/linux/proc/stat, we get negative cpu times:

	cpu 398258 232 158121 -7243116

	Our cp_time values are:

	kern.cp_time: 509774 298 202401 25981 248432116

>How-To-Repeat:

	cat /compat/linux/proc/stat

>Fix:

*** linprocfs_misc.c.orig       Thu Dec  7 05:17:55 2000
--- linprocfs_misc.c  Tue May  8 14:23:25 2001
***************
*** 71,77 ****
  /*
   * Various conversion macros
   */
! #define T2J(x) (((x) * 100) / (stathz ? stathz : hz)) /* ticks to jiffies */
  #define T2S(x) ((x) / (stathz ? stathz : hz))         /* ticks to seconds */
  #define B2K(x) ((x) >> 10)                            /* bytes to kbytes */
  #define P2B(x) ((x) << PAGE_SHIFT)                    /* pages to bytes */
--- 71,77 ----
  /*
   * Various conversion macros
   */
! #define T2J(x) (((x) * 100UL) / (stathz ? stathz : hz)) /* ticks to jiffies */
  #define T2S(x) ((x) / (stathz ? stathz : hz))         /* ticks to seconds */
  #define B2K(x) ((x) >> 10)                            /* bytes to kbytes */
  #define P2B(x) ((x) << PAGE_SHIFT)                    /* pages to bytes */
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: dwmalone 
Responsible-Changed-When: Wed May 9 03:16:06 PDT 2001 
Responsible-Changed-Why:  
Linprocfs is DES's. The patch looks straightforward though. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27215 
State-Changed-From-To: open->feedback 
State-Changed-By: des 
State-Changed-When: Sun May 27 06:16:08 PDT 2001 
State-Changed-Why:  
Kinda-fixed in -CURRENT.  Needs closer investigation. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27215 
State-Changed-From-To: feedback->closed 
State-Changed-By: des 
State-Changed-When: Sat Jun 9 09:02:36 PDT 2001 
State-Changed-Why:  
MFCed. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27215 
>Unformatted:
