From c01074b2d3b5b4c652b95a4755d98dece6b29eb1 Mon Sep 17 00:00:00 2001 From: Philippe Gerum Date: Sun, 5 Sep 2021 10:10:13 +0200 Subject: [PATCH] evl/thread: use canonical way of updating current->comm Updating tsk->comm requires holding the task lock, along with propagating the change to a few subsystems (e.g. trace, perf). Use set_task_comm() to update such field instead of open coding the change in a half baked way. Also, make sure such change is forwarded to the process event connector. Signed-off-by: Philippe Gerum --- kernel/evl/thread.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/evl/thread.c b/kernel/evl/thread.c index 4d176c157743d0..a9ac34dfc67516 100644 --- a/kernel/evl/thread.c +++ b/kernel/evl/thread.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -2386,6 +2387,7 @@ thread_factory_build(struct evl_factory *fac, const char __user *u_name, struct evl_observable *observable = NULL; struct task_struct *tsk = current; struct evl_init_thread_attr iattr; + unsigned char comm[sizeof(tsk->comm)]; struct evl_thread *curr; int ret; @@ -2464,9 +2466,10 @@ thread_factory_build(struct evl_factory *fac, const char __user *u_name, */ evl_get_element(&curr->element); - strncpy(tsk->comm, evl_element_name(&curr->element), - sizeof(tsk->comm)); - tsk->comm[sizeof(tsk->comm) - 1] = '\0'; + strncpy(comm, evl_element_name(&curr->element), sizeof(comm)); + comm[sizeof(comm) - 1] = '\0'; + set_task_comm(tsk, comm); + proc_comm_connector(tsk); return &curr->element;