lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 18 Jun 2024 23:09:09 -0500
From: "Eric W. Biederman" <ebiederm@...ssion.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,  Tejun Heo <tj@...nel.org>,
  linux-kernel@...r.kernel.org
Subject: [PATCH 09/17] signal: Test for process exit or de_thread using
 task_exit_pending


Replace "(sig->flags & SIGNAL_GROUP_EXIT || sig->group_exec_task)"
with "task_exit_pending(tsk)".

THis is just a code simplification.  Every case that sets
SIGNAL_GROUP_EXIT also sets JOBCTL_WILL_EXIT.  Similarly de_thread
sets JOBCTL_WILL_EXIT except for the one task that will exist
after exec.

Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com>
---
 fs/coredump.c   | 2 +-
 fs/exec.c       | 2 +-
 kernel/signal.c | 6 ++----
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index c8b057724bf6..f3e363fa09a3 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -389,7 +389,7 @@ static int zap_threads(struct task_struct *tsk,
 	int nr = -EAGAIN;
 
 	spin_lock_irq(&tsk->sighand->siglock);
-	if (!(signal->flags & SIGNAL_GROUP_EXIT) && !signal->group_exec_task) {
+	if (!task_exit_pending(tsk)) {
 		signal->core_state = core_state;
 		nr = zap_process(tsk, exit_code);
 		atomic_set(&core_state->nr_threads, nr);
diff --git a/fs/exec.c b/fs/exec.c
index 40073142288f..0d64313716bf 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1080,7 +1080,7 @@ static int de_thread(struct task_struct *tsk)
 	 * Kill all other threads in the thread group.
 	 */
 	spin_lock_irq(lock);
-	if ((sig->flags & SIGNAL_GROUP_EXIT) || sig->group_exec_task) {
+	if (task_exit_pending(tsk)) {
 		/*
 		 * Another group action in progress, just
 		 * return so that the signal is processed.
diff --git a/kernel/signal.c b/kernel/signal.c
index 5e67c00b9b30..12e552a35848 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2450,8 +2450,7 @@ static bool do_signal_stop(int signr)
 		WARN_ON_ONCE(signr & ~JOBCTL_STOP_SIGMASK);
 
 		if (!likely(current->jobctl & JOBCTL_STOP_DEQUEUED) ||
-		    unlikely(sig->flags & SIGNAL_GROUP_EXIT) ||
-		    unlikely(sig->group_exec_task))
+		    unlikely(task_exit_pending(current)))
 			return false;
 		/*
 		 * There is no group stop already in progress.  We must
@@ -2747,8 +2746,7 @@ bool get_signal(struct ksignal *ksig)
 		int exit_code;
 
 		/* Has this task already been marked for death? */
-		if ((signal->flags & SIGNAL_GROUP_EXIT) ||
-		     signal->group_exec_task) {
+		if (task_exit_pending(current)) {
 			signr = SIGKILL;
 			trace_signal_deliver(SIGKILL, SEND_SIG_NOINFO,
 					     &sighand->action[SIGKILL-1]);
-- 
2.41.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ