Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 846635 - sys-process/htop-3.1.2: Need file capabilities to show swap usage of all processes
Summary: sys-process/htop-3.1.2: Need file capabilities to show swap usage of all proc...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-21 05:38 UTC by Dan Moulding
Modified: 2025-05-21 21:25 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Moulding 2022-05-21 05:38:59 UTC
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.
Comment 1 Larry the Git Cow gentoo-dev 2022-05-21 08:35:03 UTC
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(+)
Comment 2 Filip Kobierski 2025-05-07 14:56:44 UTC
Instead of being put in the non-live ebuilds it was reversed in 20d5319d31378762c32b0b2344e24f37ffbaccd2.
Was that a mistake or do we not want it?
I we do not want it then can this bug be closed?
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-05-07 15:21:14 UTC
(In reply to Filip Kobierski from comment #2)
> Instead of being put in the non-live ebuilds it was reversed in
> 20d5319d31378762c32b0b2344e24f37ffbaccd2.
> Was that a mistake or do we not want it?
> I we do not want it then can this bug be closed?

Pretty sure that was accidental. From looking at commit history, I suspect I had the commit in a branch and rebased it and it got lost then.
Comment 4 Filip Kobierski 2025-05-08 10:44:42 UTC
If I were to add it again which version should I target?
Latest for sure but should I also add it to latest stable?
If so, should I destabilize it?

Also, should this bug be confirmed?
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-05-08 10:46:11 UTC
(In reply to Filip Kobierski from comment #4)
> If I were to add it again which version should I target?
> Latest for sure but should I also add it to latest stable?

No. Just in a new revision and live.

> If so, should I destabilize it?
> 
> Also, should this bug be confirmed?

I guess. We don't really do UNCO/CONF in Gentoo.
Comment 6 Larry the Git Cow gentoo-dev 2025-05-21 21:25:53 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=58e83c9f75f8ce452c0376065d69c482a1ec3d7a

commit 58e83c9f75f8ce452c0376065d69c482a1ec3d7a
Author:     Filip Kobierski <fkobi@pm.me>
AuthorDate: 2025-05-09 13:46:13 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-05-21 21:24:20 +0000

    sys-process/htop: sync live
    
    Closes: https://bugs.gentoo.org/846635
    Closes: https://bugs.gentoo.org/954884
    Signed-off-by: Filip Kobierski <fkobi@pm.me>
    Part-of: https://github.com/gentoo/gentoo/pull/41975
    Closes: https://github.com/gentoo/gentoo/pull/41975
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-process/htop/htop-9999.ebuild | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=097c98f7da21c2ca3445cc0b50d8d87e0c5f62f0

commit 097c98f7da21c2ca3445cc0b50d8d87e0c5f62f0
Author:     Filip Kobierski <fkobi@pm.me>
AuthorDate: 2025-05-09 11:37:46 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-05-21 21:24:19 +0000

    sys-process/htop: add 3.4.1-r1 fixing two bugs
    
    - README was a symlink to REAME.md
    - copied stuff from 5325dae5e32f45af0a3c9805d7e37ba3b594f1b6
    
    Bug: https://bugs.gentoo.org/846635
    Bug: https://bugs.gentoo.org/954884
    Signed-off-by: Filip Kobierski <fkobi@pm.me>
    Part-of: https://github.com/gentoo/gentoo/pull/41975
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-process/htop/htop-3.4.1-r1.ebuild | 107 ++++++++++++++++++++++++++++++++++
 1 file changed, 107 insertions(+)