diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2012-02-07 19:54:11 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-09-07 01:17:20 -0400 |
commit | 1efdb69b0bb41dec8ee3e2cac0a0f167837d0919 (patch) | |
tree | a9eb64c44d773e7b4fead20a7bfa9a354abf3bfa /ipc/sem.c | |
parent | 9582d90196aa879e6acf866f02a1adead08707b5 (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.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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 |
1678 | static int sysvipc_sem_proc_show(struct seq_file *s, void *it) | 1680 | static 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 | } |