msq               414 include/linux/security.h int security_msg_queue_alloc(struct kern_ipc_perm *msq);
msq               415 include/linux/security.h void security_msg_queue_free(struct kern_ipc_perm *msq);
msq               416 include/linux/security.h int security_msg_queue_associate(struct kern_ipc_perm *msq, int msqflg);
msq               417 include/linux/security.h int security_msg_queue_msgctl(struct kern_ipc_perm *msq, int cmd);
msq               418 include/linux/security.h int security_msg_queue_msgsnd(struct kern_ipc_perm *msq,
msq               420 include/linux/security.h int security_msg_queue_msgrcv(struct kern_ipc_perm *msq, struct msg_msg *msg,
msq              1130 include/linux/security.h static inline int security_msg_queue_alloc(struct kern_ipc_perm *msq)
msq              1135 include/linux/security.h static inline void security_msg_queue_free(struct kern_ipc_perm *msq)
msq              1138 include/linux/security.h static inline int security_msg_queue_associate(struct kern_ipc_perm *msq,
msq              1144 include/linux/security.h static inline int security_msg_queue_msgctl(struct kern_ipc_perm *msq, int cmd)
msq              1149 include/linux/security.h static inline int security_msg_queue_msgsnd(struct kern_ipc_perm *msq,
msq              1155 include/linux/security.h static inline int security_msg_queue_msgrcv(struct kern_ipc_perm *msq,
msq               120 ipc/msg.c      	struct msg_queue *msq = container_of(p, struct msg_queue, q_perm);
msq               122 ipc/msg.c      	security_msg_queue_free(&msq->q_perm);
msq               123 ipc/msg.c      	kvfree(msq);
msq               135 ipc/msg.c      	struct msg_queue *msq;
msq               140 ipc/msg.c      	msq = kvmalloc(sizeof(*msq), GFP_KERNEL);
msq               141 ipc/msg.c      	if (unlikely(!msq))
msq               144 ipc/msg.c      	msq->q_perm.mode = msgflg & S_IRWXUGO;
msq               145 ipc/msg.c      	msq->q_perm.key = key;
msq               147 ipc/msg.c      	msq->q_perm.security = NULL;
msq               148 ipc/msg.c      	retval = security_msg_queue_alloc(&msq->q_perm);
msq               150 ipc/msg.c      		kvfree(msq);
msq               154 ipc/msg.c      	msq->q_stime = msq->q_rtime = 0;
msq               155 ipc/msg.c      	msq->q_ctime = ktime_get_real_seconds();
msq               156 ipc/msg.c      	msq->q_cbytes = msq->q_qnum = 0;
msq               157 ipc/msg.c      	msq->q_qbytes = ns->msg_ctlmnb;
msq               158 ipc/msg.c      	msq->q_lspid = msq->q_lrpid = NULL;
msq               159 ipc/msg.c      	INIT_LIST_HEAD(&msq->q_messages);
msq               160 ipc/msg.c      	INIT_LIST_HEAD(&msq->q_receivers);
msq               161 ipc/msg.c      	INIT_LIST_HEAD(&msq->q_senders);
msq               164 ipc/msg.c      	retval = ipc_addid(&msg_ids(ns), &msq->q_perm, ns->msg_ctlmni);
msq               166 ipc/msg.c      		ipc_rcu_putref(&msq->q_perm, msg_rcu_free);
msq               170 ipc/msg.c      	ipc_unlock_object(&msq->q_perm);
msq               173 ipc/msg.c      	return msq->q_perm.id;
msq               176 ipc/msg.c      static inline bool msg_fits_inqueue(struct msg_queue *msq, size_t msgsz)
msq               178 ipc/msg.c      	return msgsz + msq->q_cbytes <= msq->q_qbytes &&
msq               179 ipc/msg.c      		1 + msq->q_qnum <= msq->q_qbytes;
msq               182 ipc/msg.c      static inline void ss_add(struct msg_queue *msq,
msq               188 ipc/msg.c      	list_add_tail(&mss->list, &msq->q_senders);
msq               197 ipc/msg.c      static void ss_wakeup(struct msg_queue *msq,
msq               202 ipc/msg.c      	struct list_head *h = &msq->q_senders;
msq               222 ipc/msg.c      		else if (!msg_fits_inqueue(msq, mss->msgsz)) {
msq               226 ipc/msg.c      			list_move_tail(&mss->list, &msq->q_senders);
msq               234 ipc/msg.c      static void expunge_all(struct msg_queue *msq, int res,
msq               239 ipc/msg.c      	list_for_each_entry_safe(msr, t, &msq->q_receivers, r_list) {
msq               256 ipc/msg.c      	struct msg_queue *msq = container_of(ipcp, struct msg_queue, q_perm);
msq               259 ipc/msg.c      	expunge_all(msq, -EIDRM, &wake_q);
msq               260 ipc/msg.c      	ss_wakeup(msq, &wake_q, true);
msq               261 ipc/msg.c      	msg_rmid(ns, msq);
msq               262 ipc/msg.c      	ipc_unlock_object(&msq->q_perm);
msq               266 ipc/msg.c      	list_for_each_entry_safe(msg, t, &msq->q_messages, m_list) {
msq               270 ipc/msg.c      	atomic_sub(msq->q_cbytes, &ns->msg_bytes);
msq               271 ipc/msg.c      	ipc_update_pid(&msq->q_lspid, NULL);
msq               272 ipc/msg.c      	ipc_update_pid(&msq->q_lrpid, NULL);
msq               273 ipc/msg.c      	ipc_rcu_putref(&msq->q_perm, msg_rcu_free);
msq               383 ipc/msg.c      	struct msg_queue *msq;
msq               396 ipc/msg.c      	msq = container_of(ipcp, struct msg_queue, q_perm);
msq               398 ipc/msg.c      	err = security_msg_queue_msgctl(&msq->q_perm, cmd);
msq               404 ipc/msg.c      		ipc_lock_object(&msq->q_perm);
msq               418 ipc/msg.c      		ipc_lock_object(&msq->q_perm);
msq               423 ipc/msg.c      		msq->q_qbytes = msg_qbytes;
msq               425 ipc/msg.c      		msq->q_ctime = ktime_get_real_seconds();
msq               430 ipc/msg.c      		expunge_all(msq, -EAGAIN, &wake_q);
msq               435 ipc/msg.c      		ss_wakeup(msq, &wake_q, false);
msq               436 ipc/msg.c      		ipc_unlock_object(&msq->q_perm);
msq               447 ipc/msg.c      	ipc_unlock_object(&msq->q_perm);
msq               494 ipc/msg.c      	struct msg_queue *msq;
msq               501 ipc/msg.c      		msq = msq_obtain_object(ns, msqid);
msq               502 ipc/msg.c      		if (IS_ERR(msq)) {
msq               503 ipc/msg.c      			err = PTR_ERR(msq);
msq               507 ipc/msg.c      		msq = msq_obtain_object_check(ns, msqid);
msq               508 ipc/msg.c      		if (IS_ERR(msq)) {
msq               509 ipc/msg.c      			err = PTR_ERR(msq);
msq               516 ipc/msg.c      		audit_ipc_obj(&msq->q_perm);
msq               519 ipc/msg.c      		if (ipcperms(ns, &msq->q_perm, S_IRUGO))
msq               523 ipc/msg.c      	err = security_msg_queue_msgctl(&msq->q_perm, cmd);
msq               527 ipc/msg.c      	ipc_lock_object(&msq->q_perm);
msq               529 ipc/msg.c      	if (!ipc_valid_object(&msq->q_perm)) {
msq               530 ipc/msg.c      		ipc_unlock_object(&msq->q_perm);
msq               535 ipc/msg.c      	kernel_to_ipc64_perm(&msq->q_perm, &p->msg_perm);
msq               536 ipc/msg.c      	p->msg_stime  = msq->q_stime;
msq               537 ipc/msg.c      	p->msg_rtime  = msq->q_rtime;
msq               538 ipc/msg.c      	p->msg_ctime  = msq->q_ctime;
msq               540 ipc/msg.c      	p->msg_stime_high = msq->q_stime >> 32;
msq               541 ipc/msg.c      	p->msg_rtime_high = msq->q_rtime >> 32;
msq               542 ipc/msg.c      	p->msg_ctime_high = msq->q_ctime >> 32;
msq               544 ipc/msg.c      	p->msg_cbytes = msq->q_cbytes;
msq               545 ipc/msg.c      	p->msg_qnum   = msq->q_qnum;
msq               546 ipc/msg.c      	p->msg_qbytes = msq->q_qbytes;
msq               547 ipc/msg.c      	p->msg_lspid  = pid_vnr(msq->q_lspid);
msq               548 ipc/msg.c      	p->msg_lrpid  = pid_vnr(msq->q_lrpid);
msq               561 ipc/msg.c      		err = msq->q_perm.id;
msq               564 ipc/msg.c      	ipc_unlock_object(&msq->q_perm);
msq               789 ipc/msg.c      static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg,
msq               794 ipc/msg.c      	list_for_each_entry_safe(msr, t, &msq->q_receivers, r_list) {
msq               796 ipc/msg.c      		    !security_msg_queue_msgrcv(&msq->q_perm, msg, msr->r_tsk,
msq               804 ipc/msg.c      				ipc_update_pid(&msq->q_lrpid, task_pid(msr->r_tsk));
msq               805 ipc/msg.c      				msq->q_rtime = ktime_get_real_seconds();
msq               820 ipc/msg.c      	struct msg_queue *msq;
msq               841 ipc/msg.c      	msq = msq_obtain_object_check(ns, msqid);
msq               842 ipc/msg.c      	if (IS_ERR(msq)) {
msq               843 ipc/msg.c      		err = PTR_ERR(msq);
msq               847 ipc/msg.c      	ipc_lock_object(&msq->q_perm);
msq               853 ipc/msg.c      		if (ipcperms(ns, &msq->q_perm, S_IWUGO))
msq               857 ipc/msg.c      		if (!ipc_valid_object(&msq->q_perm)) {
msq               862 ipc/msg.c      		err = security_msg_queue_msgsnd(&msq->q_perm, msg, msgflg);
msq               866 ipc/msg.c      		if (msg_fits_inqueue(msq, msgsz))
msq               876 ipc/msg.c      		ss_add(msq, &s, msgsz);
msq               878 ipc/msg.c      		if (!ipc_rcu_getref(&msq->q_perm)) {
msq               883 ipc/msg.c      		ipc_unlock_object(&msq->q_perm);
msq               888 ipc/msg.c      		ipc_lock_object(&msq->q_perm);
msq               890 ipc/msg.c      		ipc_rcu_putref(&msq->q_perm, msg_rcu_free);
msq               892 ipc/msg.c      		if (!ipc_valid_object(&msq->q_perm)) {
msq               905 ipc/msg.c      	ipc_update_pid(&msq->q_lspid, task_tgid(current));
msq               906 ipc/msg.c      	msq->q_stime = ktime_get_real_seconds();
msq               908 ipc/msg.c      	if (!pipelined_send(msq, msg, &wake_q)) {
msq               910 ipc/msg.c      		list_add_tail(&msg->m_list, &msq->q_messages);
msq               911 ipc/msg.c      		msq->q_cbytes += msgsz;
msq               912 ipc/msg.c      		msq->q_qnum++;
msq               921 ipc/msg.c      	ipc_unlock_object(&msq->q_perm);
msq              1043 ipc/msg.c      static struct msg_msg *find_msg(struct msg_queue *msq, long *msgtyp, int mode)
msq              1048 ipc/msg.c      	list_for_each_entry(msg, &msq->q_messages, m_list) {
msq              1050 ipc/msg.c      		    !security_msg_queue_msgrcv(&msq->q_perm, msg, current,
msq              1071 ipc/msg.c      	struct msg_queue *msq;
msq              1091 ipc/msg.c      	msq = msq_obtain_object_check(ns, msqid);
msq              1092 ipc/msg.c      	if (IS_ERR(msq)) {
msq              1095 ipc/msg.c      		return PTR_ERR(msq);
msq              1102 ipc/msg.c      		if (ipcperms(ns, &msq->q_perm, S_IRUGO))
msq              1105 ipc/msg.c      		ipc_lock_object(&msq->q_perm);
msq              1108 ipc/msg.c      		if (!ipc_valid_object(&msq->q_perm)) {
msq              1113 ipc/msg.c      		msg = find_msg(msq, &msgtyp, mode);
msq              1133 ipc/msg.c      			msq->q_qnum--;
msq              1134 ipc/msg.c      			msq->q_rtime = ktime_get_real_seconds();
msq              1135 ipc/msg.c      			ipc_update_pid(&msq->q_lrpid, task_tgid(current));
msq              1136 ipc/msg.c      			msq->q_cbytes -= msg->m_ts;
msq              1139 ipc/msg.c      			ss_wakeup(msq, &wake_q, false);
msq              1150 ipc/msg.c      		list_add_tail(&msr_d.r_list, &msq->q_receivers);
msq              1161 ipc/msg.c      		ipc_unlock_object(&msq->q_perm);
msq              1194 ipc/msg.c      		ipc_lock_object(&msq->q_perm);
msq              1206 ipc/msg.c      		ipc_unlock_object(&msq->q_perm);
msq              1210 ipc/msg.c      	ipc_unlock_object(&msq->q_perm);
msq              1293 ipc/msg.c      	struct msg_queue *msq = container_of(ipcp, struct msg_queue, q_perm);
msq              1297 ipc/msg.c      		   msq->q_perm.key,
msq              1298 ipc/msg.c      		   msq->q_perm.id,
msq              1299 ipc/msg.c      		   msq->q_perm.mode,
msq              1300 ipc/msg.c      		   msq->q_cbytes,
msq              1301 ipc/msg.c      		   msq->q_qnum,
msq              1302 ipc/msg.c      		   pid_nr_ns(msq->q_lspid, pid_ns),
msq              1303 ipc/msg.c      		   pid_nr_ns(msq->q_lrpid, pid_ns),
msq              1304 ipc/msg.c      		   from_kuid_munged(user_ns, msq->q_perm.uid),
msq              1305 ipc/msg.c      		   from_kgid_munged(user_ns, msq->q_perm.gid),
msq              1306 ipc/msg.c      		   from_kuid_munged(user_ns, msq->q_perm.cuid),
msq              1307 ipc/msg.c      		   from_kgid_munged(user_ns, msq->q_perm.cgid),
msq              1308 ipc/msg.c      		   msq->q_stime,
msq              1309 ipc/msg.c      		   msq->q_rtime,
msq              1310 ipc/msg.c      		   msq->q_ctime);
msq              1760 security/security.c int security_msg_queue_alloc(struct kern_ipc_perm *msq)
msq              1762 security/security.c 	int rc = lsm_ipc_alloc(msq);
msq              1766 security/security.c 	rc = call_int_hook(msg_queue_alloc_security, 0, msq);
msq              1768 security/security.c 		security_msg_queue_free(msq);
msq              1772 security/security.c void security_msg_queue_free(struct kern_ipc_perm *msq)
msq              1774 security/security.c 	call_void_hook(msg_queue_free_security, msq);
msq              1775 security/security.c 	kfree(msq->security);
msq              1776 security/security.c 	msq->security = NULL;
msq              1779 security/security.c int security_msg_queue_associate(struct kern_ipc_perm *msq, int msqflg)
msq              1781 security/security.c 	return call_int_hook(msg_queue_associate, 0, msq, msqflg);
msq              1784 security/security.c int security_msg_queue_msgctl(struct kern_ipc_perm *msq, int cmd)
msq              1786 security/security.c 	return call_int_hook(msg_queue_msgctl, 0, msq, cmd);
msq              1789 security/security.c int security_msg_queue_msgsnd(struct kern_ipc_perm *msq,
msq              1792 security/security.c 	return call_int_hook(msg_queue_msgsnd, 0, msq, msg, msqflg);
msq              1795 security/security.c int security_msg_queue_msgrcv(struct kern_ipc_perm *msq, struct msg_msg *msg,
msq              1798 security/security.c 	return call_int_hook(msg_queue_msgrcv, 0, msq, msg, target, type, mode);
msq              5949 security/selinux/hooks.c static int selinux_msg_queue_alloc_security(struct kern_ipc_perm *msq)
msq              5956 security/selinux/hooks.c 	isec = selinux_ipc(msq);
msq              5960 security/selinux/hooks.c 	ad.u.ipc_id = msq->key;
msq              5968 security/selinux/hooks.c static int selinux_msg_queue_associate(struct kern_ipc_perm *msq, int msqflg)
msq              5974 security/selinux/hooks.c 	isec = selinux_ipc(msq);
msq              5977 security/selinux/hooks.c 	ad.u.ipc_id = msq->key;
msq              5984 security/selinux/hooks.c static int selinux_msg_queue_msgctl(struct kern_ipc_perm *msq, int cmd)
msq              6011 security/selinux/hooks.c 	err = ipc_has_perm(msq, perms);
msq              6015 security/selinux/hooks.c static int selinux_msg_queue_msgsnd(struct kern_ipc_perm *msq, struct msg_msg *msg, int msqflg)
msq              6023 security/selinux/hooks.c 	isec = selinux_ipc(msq);
msq              6041 security/selinux/hooks.c 	ad.u.ipc_id = msq->key;
msq              6061 security/selinux/hooks.c static int selinux_msg_queue_msgrcv(struct kern_ipc_perm *msq, struct msg_msg *msg,
msq              6071 security/selinux/hooks.c 	isec = selinux_ipc(msq);
msq              6075 security/selinux/hooks.c 	ad.u.ipc_id = msq->key;