Package: procps
Version: 2:4.0.4-9
Severity: normal

It all started when I noticed shenenanigans in the Munin graphs for one of
my Incus system containers. Upon investigating, I noticed:

    michael@magrathea:~$ free
                   total        used        free      shared  buff/cache   
available
    Mem:         4194304      881012     1445916       27680     1894972     
3313292
    Swap:              0           0         -28

That's weird. Things became clearer (and weirder) when I looked at 
/proc/meminfo:

    michael@magrathea:~$ grep Swap /proc/meminfo
    SwapCached:            0 kB
    SwapTotal:             0 kB
    SwapFree:       18446744073709551588 kB

That clearly untrue value is 2^64-28. I'm therefore concluding that
something is treating a unsigned 64 bit value as a signed 64 bit value.

After looking at the source, that something would be scale_size(), which
receives an unsigned long...and then casts it to a signed long before doing
anything with it (except when it instead casts it to a float)...

I propose that free(1) should not cast unsigned integers to signed integers.

Yes, I realise we have a few decades before this bug actually starts to
really matter. :P

-- System Information:
Debian Release: 13.0
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 
'stable-security-debug'), (500, 'stable-security'), (500, 'stable-debug'), 
(500, 'proposed-updates-debug'), (500, 'proposed-updates'), (500, 
'oldstable-updates'), (500, 'oldstable-security'), (500, 
'oldoldstable-updates'), (500, 'oldoldstable-security'), (500, 'oldoldstable'), 
(500, 'stable'), (490, 'oldstable-debug'), (490, 'oldstable'), (400, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.12.41+deb13-amd64 (SMP w/1 CPU thread; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages procps depends on:
ii  init-system-helpers  1.68
ii  libc6                2.41-12
ii  libncursesw6         6.5+20250216-2
ii  libproc2-0           2:4.0.4-9
ii  libsystemd0          257.7-1
ii  libtinfo6            6.5+20250216-2

Versions of packages procps recommends:
ii  linux-sysctl-defaults  4.12
ii  psmisc                 23.7-2

procps suggests no packages.

-- no debconf information

Reply via email to