diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2012-02-07 16:54:11 -0800 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-09-06 22:17:20 -0700 |
commit | 1efdb69b0bb41dec8ee3e2cac0a0f167837d0919 (patch) | |
tree | a9eb64c44d773e7b4fead20a7bfa9a354abf3bfa /ipc/sem.c | |
parent | 9582d90196aa879e6acf866f02a1adead08707b5 (diff) | |
download | linux-3.10-1efdb69b0bb41dec8ee3e2cac0a0f167837d0919.tar.gz linux-3.10-1efdb69b0bb41dec8ee3e2cac0a0f167837d0919.tar.bz2 linux-3.10-1efdb69b0bb41dec8ee3e2cac0a0f167837d0919.zip |
userns: Convert ipc to use kuid and kgid where appropriate
- Store the ipc owner and creator with a kuid
- Store the ipc group and the crators group with a kgid.
- Add error handling to ipc_update_perms, allowing it to
fail if the uids and gids can not be converted to kuids
or kgids.
- Modify the proc files to display the ipc creator and
owner in the user namespace of the opener of the proc file.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'ipc/sem.c')
-rw-r--r-- | ipc/sem.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ipc/sem.c b/ipc/sem.c index 5215a81420d..58d31f1c1eb 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -1104,7 +1104,9 @@ static int semctl_down(struct ipc_namespace *ns, int semid, freeary(ns, ipcp); goto out_up; case IPC_SET: - ipc_update_perm(&semid64.sem_perm, ipcp); + err = ipc_update_perm(&semid64.sem_perm, ipcp); + if (err) + goto out_unlock; sma->sem_ctime = get_seconds(); break; default: @@ -1677,6 +1679,7 @@ void exit_sem(struct task_struct *tsk) #ifdef CONFIG_PROC_FS static int sysvipc_sem_proc_show(struct seq_file *s, void *it) { + struct user_namespace *user_ns = seq_user_ns(s); struct sem_array *sma = it; return seq_printf(s, @@ -1685,10 +1688,10 @@ static int sysvipc_sem_proc_show(struct seq_file *s, void *it) sma->sem_perm.id, sma->sem_perm.mode, sma->sem_nsems, - sma->sem_perm.uid, - sma->sem_perm.gid, - sma->sem_perm.cuid, - sma->sem_perm.cgid, + from_kuid_munged(user_ns, sma->sem_perm.uid), + from_kgid_munged(user_ns, sma->sem_perm.gid), + from_kuid_munged(user_ns, sma->sem_perm.cuid), + from_kgid_munged(user_ns, sma->sem_perm.cgid), sma->sem_otime, sma->sem_ctime); } |