[Bug 265937] linprocfs: process size incorrect

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 19 Aug 2022 09:18:55 UTC

            Bug ID: 265937
           Summary: linprocfs: process size incorrect
           Product: Base System
           Version: 12.3-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: ray@bellis.me.uk

On our FreeBSD 12.3 systems, I've detected that the process size
column in a `linprocfs` process status file (`<pid>/stat`) derived
from the `ki_size` structure is reading four times higher than it
should be, compared to values returned by e.g. `ps` and `top`.

The reason appears to be the use of the P2K macro in this line:

PS_ADD("vsize",         "%ju",  P2K((uintmax_t)kp.ki_size));


ki_size is calculated elsewhere from vm_map.size, but I could find
nothing to say explicitly whether .size is counted in pages or kB.

The issue is still present in the 14.x source.

You are receiving this mail because:
You are the assignee for the bug.