[RFC][PATCH 02/20] pspace: The parent process id of pid 1 is always0.

From: Eric W. Biederman
Date: Mon Feb 06 2006 - 14:27:42 EST



Force the parent process id of pid == 1 to always be 0. Force
this for nested pspaces.

Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>


---

arch/alpha/kernel/entry.S | 3 +++
kernel/timer.c | 2 ++
2 files changed, 5 insertions(+), 0 deletions(-)

bec203c8a3e7bec5e3bee8086361caffa71ad685
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index 7af15bf..38996ab 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -891,6 +891,9 @@ sys_getxpid:
cmpeq $4, $5, $5
beq $5, 1b
#endif
+ cmpeq $0, 1, $5
+ cmoveq $5, 0, $1
+
stq $1, 80($sp)
ret
.end sys_getxpid
diff --git a/kernel/timer.c b/kernel/timer.c
index 4f1cb0a..bae17fb 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -987,6 +987,8 @@ asmlinkage long sys_getppid(void)
#endif
break;
}
+ if (current->tgid == 1)
+ pid = 0;
return pid;
}

--
1.1.5.g3480

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/