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]
Message-Id: <20230213010020.1813-6-michael.christie@oracle.com>
Date:   Sun, 12 Feb 2023 19:00:20 -0600
From:   Mike Christie <michael.christie@...cle.com>
To:     brauner@...nel.org, ebiederm@...ssion.com,
        torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org
Cc:     Mike Christie <michael.christie@...cle.com>
Subject: [PATCH 5/5] kernel: Convert kthread to use setup_thread_fn

kthread_setup_struct can now setup the kthread struct and setup the
comm, so remove the call to kthread_setup_struct in copy_process and
have kthread.c set the setup_thread_fn callback, so it works like
io_uring.

Signed-off-by: Mike Christie <michael.christie@...cle.com>
---
 kernel/fork.c    | 5 +----
 kernel/kthread.c | 1 +
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index bd60ecc6b29c..7cdd85befa41 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -2189,10 +2189,6 @@ static __latent_entropy struct task_struct *copy_process(
 	p->io_context = NULL;
 	audit_set_context(p, NULL);
 	cgroup_fork(p);
-	if (args->kthread) {
-		if (kthread_setup_struct(p, args->fn_arg))
-			goto bad_fork_cleanup_delayacct;
-	}
 #ifdef CONFIG_NUMA
 	p->mempolicy = mpol_dup(p->mempolicy);
 	if (IS_ERR(p->mempolicy)) {
@@ -2598,6 +2594,7 @@ struct task_struct * __init fork_idle(int cpu)
 	struct task_struct *task;
 	struct kernel_clone_fns fns = {
 		.thread_fn	= &idle_dummy,
+		.setup_thread_fn = kthread_setup_struct,
 	};
 	struct kernel_clone_args args = {
 		.flags		= CLONE_VM,
diff --git a/kernel/kthread.c b/kernel/kthread.c
index b67c2caf2ccb..7776d19789f6 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -429,6 +429,7 @@ int tsk_fork_get_node(struct task_struct *tsk)
 
 static struct kernel_clone_fns thread_clone_fns = {
 	.thread_fn	= kthread,
+	.setup_thread_fn = kthread_setup_struct,
 };
 
 static void create_kthread(struct kthread_create_info *create)
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ