#1066090 psmisc: killall --older-than doesn't work as documented in a container

Package:
psmisc
Source:
psmisc
Description:
utilities that use the proc file system
Submitter:
Tim Connors
Date:
2024-03-13 10:57:05 UTC
Severity:
normal
Tags:
#1066090#5
Date:
2024-03-12 13:11:26 UTC
From:
To:
killall --older-than 30s restartx11vnc x11vnc vncserver x0tigervncserver websockify

doesn't kill any processes inside my container, whereas it always used
to work on a VM and on hardware.  Removing '--older-than 30s' kills
all such processes.  I strongly suspect the culprit is how
/proc/$pid/stat is interpreted:

#1066090#10
Date:
2024-03-13 10:44:17 UTC
From:
To:
Control: tag 1066090 fixed-upstream
/proc/uptime is sometimes seconds since host boot and sometimes seconds
since container boot.

Generally docker is the former, LXC is the latter but it's not consistent.
You can tell because if you run the uptime command
you'll see the difference. LXC basically overrides the uptime file with a
fuse-mounted file.You'd probably see there
is an issue with things like "ps -o etimes" as well which is where this
first was noticed.

There is already an upstream fix for this[1] in procps which uses
clock_gettime() instead so the start times are correct.
killall would be impacted by the same issue.
 - Craig

1:
https://gitlab.com/procps-ng/procps/-/commit/b5e19c1730bcc68d553f44b5585704e3c92267bf#83c45d853acc8384452b404946e4a0c484b16a4e_1519_1515