When the M_SWAP column is enabled, it shows swap usage of processes. However, without cap_sys_ptrace, htop cannot show the swap usage of processes owned by other users. The SWAP column will simply show 0 bytes for other users' processes. If the cap_sys_ptrace file capability is added to the htop binary, then any user can see the amount of swap used by all processes. The ebuild for htop ought to add that file capability to the binary so that the M_SWAP column will work as intended. Gentoo users that wish to not add that file capability, could do so by disabling the filecaps USE flag on the package. Reproducible: Always Steps to Reproduce: 1. As root, run some memory heavy processes so that swap is utilized by them. Virtual machines (e.g. qemu) are a good candidate. 2. As an unprivileged user, run htop and enable the M_SWAP column 3. Note that the SWAP column will show 0 for the root processes that are using SWAP 4. As root, run htop and enable the M_SWAP column 5. Not that now the SWAP column will show actual swap usage for root (and all other) processes Actual Results: The SWAP column doesn't show correct swap usage for all processes. Expected Results: The SWAP column should show correct swap usage for all processes.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5325dae5e32f45af0a3c9805d7e37ba3b594f1b6 commit 5325dae5e32f45af0a3c9805d7e37ba3b594f1b6 Author: Lars Wendler <polynomial-c@gentoo.org> AuthorDate: 2022-05-21 08:20:22 +0000 Commit: Lars Wendler <polynomial-c@gentoo.org> CommitDate: 2022-05-21 08:34:59 +0000 sys-process/htop: Added live ebuild Introducing cap_sys_ptrace file capability for htop Bug: https://bugs.gentoo.org/846635 Signed-off-by: Lars Wendler <polynomial-c@gentoo.org> sys-process/htop/htop-9999.ebuild | 113 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+)