aboutsummaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mqueue.c10
-rw-r--r--ipc/namespace.c2
2 files changed, 9 insertions, 3 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 28bd64ddeda3..b6a0d46fbad7 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -66,6 +66,7 @@ struct mqueue_inode_info {
66 66
67 struct sigevent notify; 67 struct sigevent notify;
68 struct pid* notify_owner; 68 struct pid* notify_owner;
69 struct user_namespace *notify_user_ns;
69 struct user_struct *user; /* user who created, for accounting */ 70 struct user_struct *user; /* user who created, for accounting */
70 struct sock *notify_sock; 71 struct sock *notify_sock;
71 struct sk_buff *notify_cookie; 72 struct sk_buff *notify_cookie;
@@ -139,6 +140,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
139 INIT_LIST_HEAD(&info->e_wait_q[0].list); 140 INIT_LIST_HEAD(&info->e_wait_q[0].list);
140 INIT_LIST_HEAD(&info->e_wait_q[1].list); 141 INIT_LIST_HEAD(&info->e_wait_q[1].list);
141 info->notify_owner = NULL; 142 info->notify_owner = NULL;
143 info->notify_user_ns = NULL;
142 info->qsize = 0; 144 info->qsize = 0;
143 info->user = NULL; /* set when all is ok */ 145 info->user = NULL; /* set when all is ok */
144 memset(&info->attr, 0, sizeof(info->attr)); 146 memset(&info->attr, 0, sizeof(info->attr));
@@ -536,8 +538,7 @@ static void __do_notify(struct mqueue_inode_info *info)
536 rcu_read_lock(); 538 rcu_read_lock();
537 sig_i.si_pid = task_tgid_nr_ns(current, 539 sig_i.si_pid = task_tgid_nr_ns(current,
538 ns_of_pid(info->notify_owner)); 540 ns_of_pid(info->notify_owner));
539 sig_i.si_uid = user_ns_map_uid(info->user->user_ns, 541 sig_i.si_uid = from_kuid_munged(info->notify_user_ns, current_uid());
540 current_cred(), current_uid());
541 rcu_read_unlock(); 542 rcu_read_unlock();
542 543
543 kill_pid_info(info->notify.sigev_signo, 544 kill_pid_info(info->notify.sigev_signo,
@@ -550,7 +551,9 @@ static void __do_notify(struct mqueue_inode_info *info)
550 } 551 }
551 /* after notification unregisters process */ 552 /* after notification unregisters process */
552 put_pid(info->notify_owner); 553 put_pid(info->notify_owner);
554 put_user_ns(info->notify_user_ns);
553 info->notify_owner = NULL; 555 info->notify_owner = NULL;
556 info->notify_user_ns = NULL;
554 } 557 }
555 wake_up(&info->wait_q); 558 wake_up(&info->wait_q);
556} 559}
@@ -575,7 +578,9 @@ static void remove_notification(struct mqueue_inode_info *info)
575 netlink_sendskb(info->notify_sock, info->notify_cookie); 578 netlink_sendskb(info->notify_sock, info->notify_cookie);
576 } 579 }
577 put_pid(info->notify_owner); 580 put_pid(info->notify_owner);
581 put_user_ns(info->notify_user_ns);
578 info->notify_owner = NULL; 582 info->notify_owner = NULL;
583 info->notify_user_ns = NULL;
579} 584}
580 585
581static int mq_attr_ok(struct ipc_namespace *ipc_ns, struct mq_attr *attr) 586static int mq_attr_ok(struct ipc_namespace *ipc_ns, struct mq_attr *attr)
@@ -1140,6 +1145,7 @@ retry:
1140 } 1145 }
1141 1146
1142 info->notify_owner = get_pid(task_tgid(current)); 1147 info->notify_owner = get_pid(task_tgid(current));
1148 info->notify_user_ns = get_user_ns(current_user_ns());
1143 inode->i_atime = inode->i_ctime = CURRENT_TIME; 1149 inode->i_atime = inode->i_ctime = CURRENT_TIME;
1144 } 1150 }
1145 spin_unlock(&info->lock); 1151 spin_unlock(&info->lock);
diff --git a/ipc/namespace.c b/ipc/namespace.c
index ce0a647869b1..f362298c5ce4 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -46,7 +46,7 @@ static struct ipc_namespace *create_ipc_ns(struct task_struct *tsk,
46 ipcns_notify(IPCNS_CREATED); 46 ipcns_notify(IPCNS_CREATED);
47 register_ipcns_notifier(ns); 47 register_ipcns_notifier(ns);
48 48
49 ns->user_ns = get_user_ns(task_cred_xxx(tsk, user)->user_ns); 49 ns->user_ns = get_user_ns(task_cred_xxx(tsk, user_ns));
50 50
51 return ns; 51 return ns;
52} 52}