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, 23 Jun 2020 16:54:43 -0500
From:   ebiederm@...ssion.com (Eric W. Biederman)
To:     <linux-kernel@...r.kernel.org>
Cc:     <linux-fsdevel@...r.kernel.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Oleg Nesterov <oleg@...hat.com>, Jann Horn <jannh@...gle.com>,
        Kees Cook <keescook@...omium.org>,
        Bernd Edlinger <bernd.edlinger@...mail.de>
Subject: [PATCH v2 3/6] signal: Implement SIGNAL_GROUP_DETHREAD


To allow signal_group_exit to be simplfied so that it can only test
signal->flags.  Add a new flag SIGNAL_GROUP_DETHREAD, that is set and
cleared where de_thread sets and clears group_exit_task today.

Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com>
---
 fs/exec.c                    | 3 +++
 include/linux/sched/signal.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/fs/exec.c b/fs/exec.c
index 33b5d9229c01..9c4c1ab8f715 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1145,6 +1145,7 @@ static int de_thread(struct task_struct *tsk)
 		return -EAGAIN;
 	}
 
+	sig->flags |= SIGNAL_GROUP_DETHREAD;
 	sig->group_exit_task = tsk;
 	sig->notify_count = zap_other_threads(tsk);
 	if (!thread_group_leader(tsk))
@@ -1244,6 +1245,7 @@ static int de_thread(struct task_struct *tsk)
 	}
 
 	spin_lock_irq(lock);
+	sig->flags &= ~SIGNAL_GROUP_DETHREAD;
 	sig->group_exit_task = NULL;
 	sig->notify_count = 0;
 	spin_unlock_irq(lock);
@@ -1259,6 +1261,7 @@ static int de_thread(struct task_struct *tsk)
 	/* protects against exit_notify() and __exit_signal() */
 	read_lock_irq(&tasklist_lock);
 	spin_lock(lock);
+	sig->flags &= ~SIGNAL_GROUP_DETHREAD;
 	sig->group_exit_task = NULL;
 	sig->notify_count = 0;
 	spin_unlock(lock);
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index b4f36a11be5e..5ff8697b21cd 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -253,6 +253,7 @@ struct signal_struct {
 /* Signal group actions. */
 #define SIGNAL_GROUP_EXIT	0x00000100 /* group exit in progress */
 #define SIGNAL_GROUP_COREDUMP	0x00000200 /* coredump in progress */
+#define SIGNAL_GROUP_DETHREAD	0x00000400 /* exec de_thread in progress */
 
 /* Flags applicable to the entire signal group. */
 #define SIGNAL_UNKILLABLE	0x00001000 /* for init: ignore fatal signals */
-- 
2.20.1

Powered by blists - more mailing lists