aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/sem.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-02-07 19:54:11 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-09-07 01:17:20 -0400
commit1efdb69b0bb41dec8ee3e2cac0a0f167837d0919 (patch)
treea9eb64c44d773e7b4fead20a7bfa9a354abf3bfa /ipc/sem.c
parent9582d90196aa879e6acf866f02a1adead08707b5 (diff)
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.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/ipc/sem.c b/ipc/sem.c
index 5215a81420df..58d31f1c1eb5 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1104,7 +1104,9 @@ static int semctl_down(struct ipc_namespace *ns, int semid,
1104 freeary(ns, ipcp); 1104 freeary(ns, ipcp);
1105 goto out_up; 1105 goto out_up;
1106 case IPC_SET: 1106 case IPC_SET:
1107 ipc_update_perm(&semid64.sem_perm, ipcp); 1107 err = ipc_update_perm(&semid64.sem_perm, ipcp);
1108 if (err)
1109 goto out_unlock;
1108 sma->sem_ctime = get_seconds(); 1110 sma->sem_ctime = get_seconds();
1109 break; 1111 break;
1110 default: 1112 default:
@@ -1677,6 +1679,7 @@ void exit_sem(struct task_struct *tsk)
1677#ifdef CONFIG_PROC_FS 1679#ifdef CONFIG_PROC_FS
1678static int sysvipc_sem_proc_show(struct seq_file *s, void *it) 1680static int sysvipc_sem_proc_show(struct seq_file *s, void *it)
1679{ 1681{
1682 struct user_namespace *user_ns = seq_user_ns(s);
1680 struct sem_array *sma = it; 1683 struct sem_array *sma = it;
1681 1684
1682 return seq_printf(s, 1685 return seq_printf(s,
@@ -1685,10 +1688,10 @@ static int sysvipc_sem_proc_show(struct seq_file *s, void *it)
1685 sma->sem_perm.id, 1688 sma->sem_perm.id,
1686 sma->sem_perm.mode, 1689 sma->sem_perm.mode,
1687 sma->sem_nsems, 1690 sma->sem_nsems,
1688 sma->sem_perm.uid, 1691 from_kuid_munged(user_ns, sma->sem_perm.uid),
1689 sma->sem_perm.gid, 1692 from_kgid_munged(user_ns, sma->sem_perm.gid),
1690 sma->sem_perm.cuid, 1693 from_kuid_munged(user_ns, sma->sem_perm.cuid),
1691 sma->sem_perm.cgid, 1694 from_kgid_munged(user_ns, sma->sem_perm.cgid),
1692 sma->sem_otime, 1695 sma->sem_otime,
1693 sma->sem_ctime); 1696 sma->sem_ctime);
1694} 1697}