Subject: bin/31557: vmstat(1) shows bogus values when the member of 'sturct uvmexp' is bigger than INT_MAX
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <ura@hiru.aoba.yokohama.jp>
List: netbsd-bugs
Date: 10/11/2005 18:24:00
>Number:         31557
>Category:       bin
>Synopsis:       vmstat(1) shows bogus values when the member of 'sturct uvmexp' is bigger than INT_MAX
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 11 18:24:00 +0000 2005
>Originator:     URA Hiroshi
>Release:        NetBSD 2.0_STABLE
>Organization:
>Environment:
System: NetBSD hazuki.hiru.aoba.yokohama.jp 2.0_STABLE NetBSD 2.0_STABLE (GATEWAY) #5: Tue Feb 1 17:23:06 JST 2005 ura@hazuki.hiru.aoba.yokohama.jp:/usr/src/sys/arch/i386/compile/GATEWAY i386
Architecture: i386
Machine: i386
>Description:
vmstat(1) shows bogus values when the member of 'sturct uvmexp'
(i.e. uvmexp.faults, uvmexp.intrs, uvmexp.syscalls, and so on)
is bigger than INT_MAX.

Running 'vmstat -s' produces:
2385609202 software interrupts
2501490599 system calls

On i386, Two above values are bigger then INT_MAX because INT_MAX
is 2147483647(0x7fffffff). At this time, vmstat(1) show bogus values.

 $ vmstat
 procs    memory      page                       disks      faults      cpu
 r b w    avm    fre  flt  re  pi   po   fr   sr f0 m0 w0   in   sy  cs us sy id
 0 8 0 575976   7700   31   0   0    0    0    0  0  0  1 4294967139 4294967147  52  0  1 99

>How-To-Repeat:
Run 'vmstat', observe that the member of 'sturct uvmexp' is bigger
than INT_MAX.

>Fix:
It seems that the members of 'struct uvmexp' should be 'unsigned int'
instead of 'int'.