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/msg.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/msg.c')
-rw-r--r-- | ipc/msg.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -443,9 +443,12 @@ static int msgctl_down(struct ipc_namespace *ns, int msqid, int cmd, | |||
443 | goto out_unlock; | 443 | goto out_unlock; |
444 | } | 444 | } |
445 | 445 | ||
446 | err = ipc_update_perm(&msqid64.msg_perm, ipcp); | ||
447 | if (err) | ||
448 | goto out_unlock; | ||
449 | |||
446 | msq->q_qbytes = msqid64.msg_qbytes; | 450 | msq->q_qbytes = msqid64.msg_qbytes; |
447 | 451 | ||
448 | ipc_update_perm(&msqid64.msg_perm, ipcp); | ||
449 | msq->q_ctime = get_seconds(); | 452 | msq->q_ctime = get_seconds(); |
450 | /* sleeping receivers might be excluded by | 453 | /* sleeping receivers might be excluded by |
451 | * stricter permissions. | 454 | * stricter permissions. |
@@ -922,6 +925,7 @@ out: | |||
922 | #ifdef CONFIG_PROC_FS | 925 | #ifdef CONFIG_PROC_FS |
923 | static int sysvipc_msg_proc_show(struct seq_file *s, void *it) | 926 | static int sysvipc_msg_proc_show(struct seq_file *s, void *it) |
924 | { | 927 | { |
928 | struct user_namespace *user_ns = seq_user_ns(s); | ||
925 | struct msg_queue *msq = it; | 929 | struct msg_queue *msq = it; |
926 | 930 | ||
927 | return seq_printf(s, | 931 | return seq_printf(s, |
@@ -933,10 +937,10 @@ static int sysvipc_msg_proc_show(struct seq_file *s, void *it) | |||
933 | msq->q_qnum, | 937 | msq->q_qnum, |
934 | msq->q_lspid, | 938 | msq->q_lspid, |
935 | msq->q_lrpid, | 939 | msq->q_lrpid, |
936 | msq->q_perm.uid, | 940 | from_kuid_munged(user_ns, msq->q_perm.uid), |
937 | msq->q_perm.gid, | 941 | from_kgid_munged(user_ns, msq->q_perm.gid), |
938 | msq->q_perm.cuid, | 942 | from_kuid_munged(user_ns, msq->q_perm.cuid), |
939 | msq->q_perm.cgid, | 943 | from_kgid_munged(user_ns, msq->q_perm.cgid), |
940 | msq->q_stime, | 944 | msq->q_stime, |
941 | msq->q_rtime, | 945 | msq->q_rtime, |
942 | msq->q_ctime); | 946 | msq->q_ctime); |