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>
This commit is contained in:
14
ipc/msg.c
14
ipc/msg.c
@@ -443,9 +443,12 @@ static int msgctl_down(struct ipc_namespace *ns, int msqid, int cmd,
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
err = ipc_update_perm(&msqid64.msg_perm, ipcp);
|
||||
if (err)
|
||||
goto out_unlock;
|
||||
|
||||
msq->q_qbytes = msqid64.msg_qbytes;
|
||||
|
||||
ipc_update_perm(&msqid64.msg_perm, ipcp);
|
||||
msq->q_ctime = get_seconds();
|
||||
/* sleeping receivers might be excluded by
|
||||
* stricter permissions.
|
||||
@@ -922,6 +925,7 @@ out:
|
||||
#ifdef CONFIG_PROC_FS
|
||||
static int sysvipc_msg_proc_show(struct seq_file *s, void *it)
|
||||
{
|
||||
struct user_namespace *user_ns = seq_user_ns(s);
|
||||
struct msg_queue *msq = it;
|
||||
|
||||
return seq_printf(s,
|
||||
@@ -933,10 +937,10 @@ static int sysvipc_msg_proc_show(struct seq_file *s, void *it)
|
||||
msq->q_qnum,
|
||||
msq->q_lspid,
|
||||
msq->q_lrpid,
|
||||
msq->q_perm.uid,
|
||||
msq->q_perm.gid,
|
||||
msq->q_perm.cuid,
|
||||
msq->q_perm.cgid,
|
||||
from_kuid_munged(user_ns, msq->q_perm.uid),
|
||||
from_kgid_munged(user_ns, msq->q_perm.gid),
|
||||
from_kuid_munged(user_ns, msq->q_perm.cuid),
|
||||
from_kgid_munged(user_ns, msq->q_perm.cgid),
|
||||
msq->q_stime,
|
||||
msq->q_rtime,
|
||||
msq->q_ctime);
|
||||
|
Reference in New Issue
Block a user