Bug 137519
| Summary: | ps shows bad PPID | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 3 | Reporter: | Keiichi Mori <kmori> | ||||
| Component: | kernel | Assignee: | Ernie Petrides <petrides> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Brian Brock <bbrock> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 3.0 | CC: | petrides, riel, tao | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2004-10-30 00:03:05 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
Created attachment 105931 [details]
sample test case
Thank you for the report and test case. I will coordinate my work on this bug and its dup (135891) for U5. *** This bug has been marked as a duplicate of 135891 *** A fix for this problem has just been committed to the RHEL3 U5 patch pool this evening (in kernel version 2.4.21-27.16.EL). An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2005-294.html |
From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.3) Gecko/20040914 Firefox/0.10 Description of problem: FROM IT#50994. --- Event posted 10-06-2004 10:19pm by kmori with duration of 0.00 --- [Description] ps command shows different PPID,PID from the value returned by getppid(),getpid(). [Environment] RHEL3 GA, U1, U2, U3 [Steps to reproduction] The test (uploaded here) case works as below: ProcessA -- create_thread() ---> ThreadB --- execl() ---> ProcessC 1. compile and execute test case $ make $ ./wait_2_mt ProcessA: pid=4505, ppid=4166 ThreadB: pid=4505, ppid=4166 ProcessC: pid=4507, ppid=4505 ProcessC: pid=4507, ppid=4505 ... 2. execute ps command during test case is running. $ ps almx F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND 0 500 4505 4166 16 0 13440 412 schedu S pts/1 0:00 ./wait_2_mt 1 500 4506 4505 19 0 13440 412 wait4 S pts/1 0:00 ./wait_2_mt 0 500 4507 4506 15 0 2284 288 schedu S pts/1 0:00 1 You can find the difference between the value of getpid(),getppid() and ps's. [Expected result] Provide same information between getpid(),getppid() and ps. [Additional infomation] I found this difference happens due to below kernel implementation: linux-2.4/kernel/timer.c::sys_getpid() asmlinkage long sys_getpid(void) { return current->tgid; } linux-2.4/kernel/timer.c::sys_getppid() parent = me->group_leader->real_parent; for (;;) { pid = parent->tgid; linux-2.4/fs/proc/array.c::task_state() buffer += sprintf(buffer, "State:\t%s\n" "Tgid:\t%d\n" "Pid:\t%d\n" "PPid:\t%d\n" "TracerPid:\t%d\n" "Uid:\t%d\t%d\t%d\t%d\n" "Gid:\t%d\t%d\t%d\t%d\n", get_task_state(p), p->tgid, p->pid, p->pid ? p->real_parent->pid : 0, 0, p->uid, p->euid, p->suid, p->fsuid, p->gid, p->egid, p->sgid, p->fsgid); linux-2.4/fs/proc/array.c::proc_pid_stat() read_lock(&tasklist_lock); ppid = task->pid ? task->real_parent->pid : 0; read_unlock(&tasklist_lock); getpid() and getppid() return not pid but tgid. The other hand, /proc/<pid>/{stat,status} shows not tgid but pid. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: See above. Expected Results: Provide consist information between getpid(),getppid() and ps. Additional info: BZ#13203 is same issue for RHEL4. upstream kernel (2.6) has been fixed. RHEL3 kernel has also NPTL features,then should be fixed in RHEL3, too.