Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 May 2001 14:39:28 -0700 (PDT)
From:      Jim.Pirzyk@disney.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/27215: /compat/linux/proc/stat has overflows
Message-ID:  <200105082139.f48LdSM23731@snoopy.fan.fa.disney.com>

next in thread | raw e-mail | index | archive | help

>Number:         27215
>Category:       kern
>Synopsis:       when cat'ing /compat/linux/proc/stat, we have negative numbers
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 08 14:40:01 PDT 2001
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105082139.f48LdSM23731>