! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Incorrect UID reported
Status:
RESOLVED: FIXED
Product:
Xfce4-taskmanager
Component:
General

Comments

Description Al S. 2016-11-18 18:14:25 CET
xfce4-taskmanager 1.0.1
Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) i686 GNU/Linux
Debian Jessie



xfce4-taskmanager reports UID root when 3 other programs report UID unbound. I assume this is because Unbound drops privileges from UID root to UID unbound and somehow xfce4-taskmanager does not check for that. Please fix, I spent a long time debugging Unbound for this when the problem was xfce4-taskmanager.

myuser@debian:~$ grep unbound /etc/group
unbound:x:125:

1.
myuser@debian:~$ top -b
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
17497 unbound   20   0   16184   6980   3336 S   0.0  0.2   0:00.01 unbound

2.
myuser@debian:~$ ps -u -p $(pidof unbound)
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
unbound  17497  0.0  0.1  16184  6980 ?        Ss   16:53   0:00 /usr/sbin/unbound

3.
myuser@debian:~$ uid=$(awk '/^Uid:/{print $2}' /proc/$(pidof unbound)/status)
myuser@debian:~$ getent passwd "$uid" | awk -F: '{print $1}'
unbound
Comment 1 Al S. 2016-11-24 12:17:11 CET
Created attachment 6907 
Proposed fix

To get the correct UID, it should use "/proc/%d/task" but it is using "/proc/%d/stat". I have attached a patch.
Comment 2 Simon Steinbeiss editbugs 2017-01-26 23:12:45 CET
Thanks for the patch, but to be honest I cannot reproduce your problem.

Can you please check with the latest version of taskman or git master? (Yours is 1yr older than the latest release, which is still 2 years old.)

Anyhow, I'd like to get this fixed before I push out a new release.
Comment 3 Simon Steinbeiss editbugs 2017-01-26 23:13:37 CET
*** Bug 12446 has been marked as a duplicate of this bug. ***
Comment 4 Skunnyk editbugs 2017-06-02 23:11:03 CEST
I can reproduce the problem with taskmanager 1.2.0 (problem with suid binaries ?), and I confirm that the patch fix it ! I think it can be merged :)
Comment 5 Git Bot editbugs 2017-06-14 00:13:42 CEST
Alberto Sepo referenced this bugreport in commit bd1e267062cafd4f4e2319b4df21b3352825f59d

Fix incorrect UID reporting (Bug #12970)

https://git.xfce.org/apps/xfce4-taskmanager/commit?id=bd1e267062cafd4f4e2319b4df21b3352825f59d
Comment 6 Simon Steinbeiss editbugs 2017-06-14 00:14:09 CEST
Ok, thanks for testing/reproducing!
Comment 7 bobbyhopere 2017-07-01 12:21:21 CEST
Created attachment 7210 
UID fix correctly

The patch that was already committed apparently fixes the issue but using a non-documented method. My patch fixes the issue as described in "man proc". (The UID is extracted by parsing /proc/*/status not by using stat() on /proc/*/task). Also, my patch can easily be extended to also report other UIDs besides the "effective" UID: real, effective, saved set, and filesystem UIDs. That is up to the taskmanager developers to implement because I don't know GTK.

RECAP: The reason why the first patch was proposed was because some programs start as root and later change to a different effective UID. Unbound is an example of such program. This was previously incorrectly reported as root by taskmanager.
Comment 8 Skunnyk editbugs 2017-11-11 19:39:38 CET
I confirm that your patch works.
Comment 9 Simon Steinbeiss editbugs 2017-11-11 22:12:14 CET
Crap, I missed the bugid in the commit :'(

Anyway, pushed to master: https://git.xfce.org/apps/xfce4-taskmanager/commit/?id=946be336114ed84ad5d24838b4ae14a0bfc0f0fe

Bug #12970

Reported by:
Al S.
Reported on: 2016-11-18
Last modified on: 2017-11-11
Duplicates (1):
  • 12446 Wrong user ID (UID) for some processes

People

Assignee:
Simon Steinbeiss
CC List:
4 users

Version

Version:
unspecified

Attachments

Proposed fix (835 bytes, patch)
2016-11-24 12:17 CET , Al S.
no flags
UID fix correctly (1.41 KB, patch)
2017-07-01 12:21 CEST , bobbyhopere
no flags

Additional information