Web lists-archives.com

[RFC][PATCH 07/11] signal: Deliver group signals via PIDTYPE_TGID not PIDTYPE_PID




Now that we can make the distinction use PIDTYPE_TGID rather than
PIDTYPE_PID.  There is no immediate effect as they point point at the
same task, but this allows using enum pid_type instead of bool group
in the signal sending functions.

Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
---
 kernel/signal.c            | 4 ++--
 kernel/time/posix-timers.c | 7 +++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 8d8a940422a8..7caf17d76a84 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1315,7 +1315,7 @@ int kill_pid_info(int sig, struct siginfo *info, struct pid *pid)
 
 	for (;;) {
 		rcu_read_lock();
-		p = pid_task(pid, PIDTYPE_PID);
+		p = pid_task(pid, PIDTYPE_TGID);
 		if (p)
 			error = group_send_sig_info(sig, info, p);
 		rcu_read_unlock();
@@ -1361,7 +1361,7 @@ int kill_pid_info_as_cred(int sig, struct siginfo *info, struct pid *pid,
 		return ret;
 
 	rcu_read_lock();
-	p = pid_task(pid, PIDTYPE_PID);
+	p = pid_task(pid, PIDTYPE_TGID);
 	if (!p) {
 		ret = -ESRCH;
 		goto out_unlock;
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index e08ce3f27447..d640e26d0de0 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -347,12 +347,11 @@ int posix_timer_event(struct k_itimer *timr, int si_private)
 	 */
 	timr->sigq->info.si_sys_private = si_private;
 
+	shared = !(timr->it_sigev_notify & SIGEV_THREAD_ID);
 	rcu_read_lock();
-	task = pid_task(timr->it_pid, PIDTYPE_PID);
-	if (task) {
-		shared = !(timr->it_sigev_notify & SIGEV_THREAD_ID);
+	task = pid_task(timr->it_pid, shared ? PIDTYPE_TGID : PIDTYPE_PID);
+	if (task)
 		ret = send_sigqueue(timr->sigq, task, shared);
-	}
 	rcu_read_unlock();
 	/* If we failed to send the signal the timer stops. */
 	return ret > 0;
-- 
2.17.1