Certain places in the virtual pid return locations need special handling
to return the appropriate information back to the user.
Signed-off-by: Hubertus Franke <[email protected]>
---
fs/proc/array.c | 15 +++++++++------
fs/proc/base.c | 2 ++
kernel/signal.c | 8 ++++++--
3 files changed, 17 insertions(+), 8 deletions(-)
Index: linux-2.6.15/fs/proc/base.c
===================================================================
--- linux-2.6.15.orig/fs/proc/base.c 2006-01-17 08:37:07.000000000 -0500
+++ linux-2.6.15/fs/proc/base.c 2006-01-17 08:37:09.000000000 -0500
@@ -2103,6 +2103,8 @@
for ( ; p != &init_task; p = next_task(p)) {
int tgid = task_vpid_ctx(p, current);
+ if (tgid < 0)
+ continue;
if (!pid_alive(p))
continue;
if (--index >= 0)
Index: linux-2.6.15/fs/proc/array.c
===================================================================
--- linux-2.6.15.orig/fs/proc/array.c 2006-01-17 08:37:07.000000000 -0500
+++ linux-2.6.15/fs/proc/array.c 2006-01-17 08:37:09.000000000 -0500
@@ -164,13 +164,16 @@
pid_t ppid, tpid;
read_lock(&tasklist_lock);
- if (pid_alive(p))
+ if (pid_alive(p)) {
ppid = task_vtgid_ctx(p->group_leader->real_parent, current);
- else
+ if (ppid < 0) ppid = 1;
+ } else {
ppid = 0;
- if (pid_alive(p) && p->ptrace)
+ }
+ if (pid_alive(p) && p->ptrace) {
tpid = task_vppid_ctx(p, current);
- else
+ if (tpid < 0) tpid = 0;
+ } else
tpid = 0;
buffer += sprintf(buffer,
"State:\t%s\n"
@@ -183,8 +186,8 @@
"Gid:\t%d\t%d\t%d\t%d\n",
get_task_state(p),
(p->sleep_avg/1024)*100/(1020000000/1024),
- task_vtgid_ctx(p,current),
- task_vpid_ctx(p,current),
+ task_vtgid_ctx(p, current),
+ task_vpid_ctx(p, current),
ppid, tpid,
p->uid, p->euid, p->suid, p->fsuid,
p->gid, p->egid, p->sgid, p->fsgid);
Index: linux-2.6.15/kernel/signal.c
===================================================================
--- linux-2.6.15.orig/kernel/signal.c 2006-01-17 08:37:07.000000000 -0500
+++ linux-2.6.15/kernel/signal.c 2006-01-17 08:37:09.000000000 -0500
@@ -2257,6 +2257,12 @@
struct siginfo info;
struct task_struct *p;
+ pid = vpid_to_pid(pid);
+ if (pid < 0)
+ return pid;
+ tgid = vpid_to_pid(tgid);
+ if (tgid < 0)
+ return tgid;
error = -ESRCH;
info.si_signo = sig;
info.si_errno = 0;
@@ -2264,8 +2270,6 @@
info.si_pid = task_vtgid(current);
info.si_uid = current->uid;
- pid = vpid_to_pid(pid);
- tgid = vpid_to_pid(tgid);
read_lock(&tasklist_lock);
p = find_task_by_pid(pid);
if (p && (tgid <= 0 || task_tgid(p) == tgid)) {
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]