[PATCH -mm] ipc-mqueuec-change-__do_notify-to-bypass-check_kill_permission-fix

From: Oleg Nesterov
Date: Fri Mar 27 2020 - 15:56:53 EST


On 03/26, Eric W. Biederman wrote:
>
> > + task = pid_task(info->notify_owner, PIDTYPE_PID);
> ^^^^^^^^^^^^
> Minor nit: If we are doing the task lookup ourselves that can and
> should be PIDTYPE_TGID.

I think this shouldn't make any difference, in particular because
do_mq_notify() does "notify_owner = task_tgid()" and we do not care
about exec.

But I agree, pid_task(PIDTYPE_TGID) looks better, thanks.


diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 63b164932ffd..9a44dcb04e13 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -801,7 +801,7 @@ static void __do_notify(struct mqueue_inode_info *info)
* bypass check_kill_permission(). It is from kernel
* but si_fromuser() can't know this.
*/
- task = pid_task(info->notify_owner, PIDTYPE_PID);
+ task = pid_task(info->notify_owner, PIDTYPE_TGID);
if (task)
do_send_sig_info(info->notify.sigev_signo,
&sig_i, task, PIDTYPE_TGID);