Bug 1122977 - A process can have multiple names and there is no single way to update them all
Summary: A process can have multiple names and there is no single way to update them all
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-24 13:49 UTC by Nikos Mavrogiannopoulos
Modified: 2014-07-24 14:21 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-24 14:21:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1107682 0 unspecified CLOSED PS gives different names on processes depending on the parameters used 2021-02-22 00:41:40 UTC

Description Nikos Mavrogiannopoulos 2014-07-24 13:49:16 UTC
There are multiple ways to obtain a process name in Linux:
 1. /proc/PID/cmdline: The command line arguments that were passed (including argv[0] which is the process name)
 2. /proc/PID/comm: The name of the command used, that can be initially equal to argv[0].

Method (1) is read by "ps -ef", and the way for a program to overwrite it is via questionable code like:
https://github.com/karelzak/util-linux/blob/master/lib/setproctitle.c
https://gitorious.org/libsetproctitle/libsetproctitle/source/50e52b1ca62aacc111832f1e0078b55110534c6e:setproctitle.c

Method (2) is read by "ps -e" or top and the way for a program to overwrite it is via prctl(PR_SET_NAME).

When overwriting the process name using prctl() or the setproctitle() above, only one of the /proc entries is updated leaving multiple names on a single process. That makes process name changing on a Linux system an interesting adventure. Some programs use the setproctitle() hack, while others the prctl() call, making process listing inconsistent. That is, some overwritten names show in ps -e for some programs, while for other programs they show in ps -ef. The procps maintainers believe that this isn't an issue of procps but rather of the kernel itself (see #1107682), and I tend to concur.

I believe there should be a simple way for applications to overwrite their name.

Comment 1 Josh Boyer 2014-07-24 14:21:20 UTC
Please take this to the upstream kernel developers.


Note You need to log in before you can comment on or make changes to this bug.