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: <20250331121820.455916-4-bhupesh@igalia.com>
Date: Mon, 31 Mar 2025 17:48:20 +0530
From: Bhupesh <bhupesh@...lia.com>
To: akpm@...ux-foundation.org
Cc: bhupesh@...lia.com,
	kernel-dev@...lia.com,
	linux-kernel@...r.kernel.org,
	bpf@...r.kernel.org,
	linux-perf-users@...r.kernel.org,
	linux-fsdevel@...r.kernel.org,
	linux-mm@...ck.org,
	oliver.sang@...el.com,
	lkp@...el.com,
	laoar.shao@...il.com,
	pmladek@...e.com,
	rostedt@...dmis.org,
	mathieu.desnoyers@...icios.com,
	arnaldo.melo@...il.com,
	alexei.starovoitov@...il.com,
	andrii.nakryiko@...il.com,
	mirq-linux@...e.qmqm.pl,
	peterz@...radead.org,
	willy@...radead.org,
	david@...hat.com,
	viro@...iv.linux.org.uk,
	keescook@...omium.org,
	ebiederm@...ssion.com,
	brauner@...nel.org,
	jack@...e.cz,
	mingo@...hat.com,
	juri.lelli@...hat.com,
	bsegall@...gle.com,
	mgorman@...e.de,
	vschneid@...hat.com
Subject: [PATCH v2 3/3] kthread: Use 'task_struct->full_name' to store kthread's full name

Commit 6986ce24fc00 ("kthread: dynamically allocate memory to store
kthread's full name"), added 'full_name' in parallel to 'comm' for
kthread names.

Now that we have added 'full_name' added to 'task_struct' itself,
drop the additional 'full_name' entry from 'struct kthread' and also
its usage.

Signed-off-by: Bhupesh <bhupesh@...lia.com>
---
 kernel/kthread.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/kernel/kthread.c b/kernel/kthread.c
index 5dc5b0d7238e..46fe19b7ef76 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -66,8 +66,6 @@ struct kthread {
 #ifdef CONFIG_BLK_CGROUP
 	struct cgroup_subsys_state *blkcg_css;
 #endif
-	/* To store the full name if task comm is truncated. */
-	char *full_name;
 	struct task_struct *task;
 	struct list_head hotplug_node;
 	struct cpumask *preferred_affinity;
@@ -108,12 +106,12 @@ void get_kthread_comm(char *buf, size_t buf_size, struct task_struct *tsk)
 {
 	struct kthread *kthread = to_kthread(tsk);
 
-	if (!kthread || !kthread->full_name) {
+	if (!kthread || !tsk->full_name) {
 		strscpy(buf, tsk->comm, buf_size);
 		return;
 	}
 
-	strscpy_pad(buf, kthread->full_name, buf_size);
+	strscpy_pad(buf, tsk->full_name, buf_size);
 }
 
 bool set_kthread_struct(struct task_struct *p)
@@ -153,7 +151,6 @@ void free_kthread_struct(struct task_struct *k)
 	WARN_ON_ONCE(kthread->blkcg_css);
 #endif
 	k->worker_private = NULL;
-	kfree(kthread->full_name);
 	kfree(kthread);
 }
 
@@ -430,7 +427,7 @@ static int kthread(void *_create)
 		kthread_exit(-EINTR);
 	}
 
-	self->full_name = create->full_name;
+	self->task->full_name = create->full_name;
 	self->threadfn = threadfn;
 	self->data = data;
 
-- 
2.38.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ