2006-01-17 14:51:08

by Serge E. Hallyn

[permalink] [raw]
Subject: RFC [patch 24/34] PID Virtualization use vpgid_to_pgid function

Same as previous patch for pids, but here we focus on virtual
ids that are interpreted as process group ids. Since process
groups ids can be negative, they are handled as to deal with
the negative value.

Signed-off-by: Hubertus Franke <[email protected]>
---
fs/fcntl.c | 1 +
kernel/capability.c | 1 +
kernel/exit.c | 2 ++
3 files changed, 4 insertions(+)

Index: linux-2.6.15/fs/fcntl.c
===================================================================
--- linux-2.6.15.orig/fs/fcntl.c 2006-01-17 08:37:05.000000000 -0500
+++ linux-2.6.15/fs/fcntl.c 2006-01-17 08:37:06.000000000 -0500
@@ -267,6 +267,7 @@
if (err)
return err;

+ arg = vpgid_to_pgid(arg);
f_modown(filp, arg, current->uid, current->euid, force);
return 0;
}
Index: linux-2.6.15/kernel/capability.c
===================================================================
--- linux-2.6.15.orig/kernel/capability.c 2006-01-17 08:37:06.000000000 -0500
+++ linux-2.6.15/kernel/capability.c 2006-01-17 08:37:06.000000000 -0500
@@ -188,6 +188,7 @@
if (get_user(pid, &header->pid))
return -EFAULT;

+ pid = vpgid_to_pgid(pid);
if (pid && pid != task_pid(current) && !capable(CAP_SETPCAP))
return -EPERM;

Index: linux-2.6.15/kernel/exit.c
===================================================================
--- linux-2.6.15.orig/kernel/exit.c 2006-01-17 08:37:06.000000000 -0500
+++ linux-2.6.15/kernel/exit.c 2006-01-17 08:37:06.000000000 -0500
@@ -1556,6 +1556,8 @@
if (options & ~(WNOHANG|WUNTRACED|WCONTINUED|
__WNOTHREAD|__WCLONE|__WALL))
return -EINVAL;
+ if (pid != -1)
+ pid = vpgid_to_pgid(pid);
ret = do_wait(pid, options | WEXITED, NULL, stat_addr, ru);

/* avoid REGPARM breakage on x86: */

--