From: Oleg Nesterov Date: Wed, 23 Sep 2009 22:57:01 +0000 (-0700) Subject: signals: send_sigio: use do_send_sig_info() to avoid check_kill_permission() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=06f1631a1671bce2d59d58cb1debdf23e1803ebf;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git signals: send_sigio: use do_send_sig_info() to avoid check_kill_permission() group_send_sig_info()->check_kill_permission() assumes that current is the sender and uses current_cred(). This is not true in send_sigio_to_task() case. From the security pov the sender is not current, but the task which did fcntl(F_SETOWN), that is why we have sigio_perm() which uses the right creds to check. Fortunately, send_sigio() always sends either SEND_SIG_PRIV or SI_FROMKERNEL() signal, so check_kill_permission() does nothing. But still it would be tidier to avoid this bogus security check and save a couple of cycles. Signed-off-by: Oleg Nesterov Cc: Peter Zijlstra Cc: stephane eranian Cc: Ingo Molnar Cc: Roland McGrath Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/fcntl.c b/fs/fcntl.c index ae413086db97..50a988993262 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -461,11 +461,11 @@ static void send_sigio_to_task(struct task_struct *p, else si.si_band = band_table[reason - POLL_IN]; si.si_fd = fd; - if (!group_send_sig_info(signum, &si, p)) + if (!do_send_sig_info(signum, &si, p, true)) break; /* fall-through: fall back on the old plain SIGIO signal */ case 0: - group_send_sig_info(SIGIO, SEND_SIG_PRIV, p); + do_send_sig_info(SIGIO, SEND_SIG_PRIV, p, true); } }