[PATCH v5 1/6] treewide: Get rid of get_task_comm()
From: André Almeida <andrealmeid@igalia.com>
Date: 2026-08-27 18:23:42
Also in:
linux-api, linux-mm, lkml
Subsystem:
amd kfd, arm mali panfrost drm driver, arm mali panthor drm driver, audit subsystem, bluetooth subsystem, dma buffer sharing framework, drm drivers, drm drivers and misc gpu patches, drm drivers for lima, exec & binfmt api, elf, extended verification module (evm), filesystems (vfs and infrastructure), hardware tracing facilities, integrity measurement architecture (ima), integrity policy enforcement (ipe), landlock security module, netfilter, networking drivers, networking [general], printk, proc filesystem, radeon and amdgpu drm drivers, scheduler, security subsystem, sync file framework, system trace module class, the rest, tty layer and serial drivers, virtio gpu driver · Maintainers:
Felix Kuehling, Boris Brezillon, Rob Herring, Steven Price, Adrián Larumbe, Liviu Dudau, Paul Moore, Eric Paris, Marcel Holtmann, Luiz Augusto von Dentz, Sumit Semwal, Christian König, David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Qiang Yu, Kees Cook, Mimi Zohar, Roberto Sassu, Alexander Viro, Christian Brauner, Alexander Shishkin, Dmitry Kasatkin, Fan Wu, Mickaël Salaün, Pablo Neira Ayuso, Florian Westphal, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Petr Mladek, Alex Deucher, Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot, James Morris, "Serge E. Hallyn", Linus Torvalds, Greg Kroah-Hartman, Jiri Slaby, David Airlie, Gerd Hoffmann, Dmitry Osipenko
Since commit 4cc0473d7754 ("get rid of __get_task_comm()"),
get_task_comm() does just a redundant check for the buffer size and call
strscpy_pad(). Replace get_task_comm() calls with strscpy_pad(), that will
do the right thing if the buffers sizes doesn't match: zero-pad if it's
bigger, and truncate if it's smaller.
Link: https://lore.kernel.org/lkml/CAHk-=wi5c=_-FBGo_88CowJd_F-Gi6Ud9d=TALm65ReN7YjrMw@mail.gmail.com/ (local)
Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
Changes from v1:
- Fix for security/ipe/audit.c and net/netfilter/nf_tables_api.c
---
drivers/connector/cn_proc.c | 2 +-
drivers/dma-buf/sw_sync.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 2 +-
drivers/gpu/drm/lima/lima_ctx.c | 2 +-
drivers/gpu/drm/panfrost/panfrost_gem.c | 2 +-
drivers/gpu/drm/panthor/panthor_gem.c | 2 +-
drivers/gpu/drm/panthor/panthor_sched.c | 2 +-
drivers/gpu/drm/virtio/virtgpu_ioctl.c | 2 +-
drivers/hwtracing/stm/core.c | 2 +-
drivers/tty/tty_audit.c | 2 +-
fs/binfmt_elf.c | 2 +-
fs/binfmt_elf_fdpic.c | 2 +-
fs/proc/array.c | 2 +-
include/linux/sched.h | 19 -------------------
kernel/audit.c | 6 ++++--
kernel/auditsc.c | 6 ++++--
kernel/printk/printk.c | 2 +-
kernel/sys.c | 2 +-
net/bluetooth/hci_sock.c | 2 +-
net/netfilter/nf_tables_api.c | 4 +++-
security/integrity/integrity_audit.c | 3 ++-
security/ipe/audit.c | 3 ++-
security/landlock/domain.c | 2 +-
security/lsm_audit.c | 7 ++++---
29 files changed, 42 insertions(+), 52 deletions(-)
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index 0056ab81fbc3..c78243ed3c2a 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c@@ -278,7 +278,7 @@ void proc_comm_connector(struct task_struct *task) ev->what = PROC_EVENT_COMM; ev->event_data.comm.process_pid = task->pid; ev->event_data.comm.process_tgid = task->tgid; - get_task_comm(ev->event_data.comm.comm, task); + strscpy_pad(ev->event_data.comm.comm, task->comm); memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); msg->ack = 0; /* not used */
diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c
index 8df20b0218a9..d501657ad801 100644
--- a/drivers/dma-buf/sw_sync.c
+++ b/drivers/dma-buf/sw_sync.c@@ -312,7 +312,7 @@ static int sw_sync_debugfs_open(struct inode *inode, struct file *file) struct sync_timeline *obj; char task_comm[TASK_COMM_LEN]; - get_task_comm(task_comm, current); + strscpy_pad(task_comm, current->comm); obj = sync_timeline_create(task_comm); if (!obj)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
index 9b10d015671c..2c92bb12c269 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c@@ -73,7 +73,7 @@ struct amdgpu_amdkfd_fence *amdgpu_amdkfd_fence_create(u64 context, /* This reference gets released in amdkfd_fence_release */ mmgrab(mm); fence->mm = mm; - get_task_comm(fence->timeline_name, current); + strscpy_pad(fence->timeline_name, current->comm); spin_lock_init(&fence->lock); fence->context_id = context_id; dma_fence_init(&fence->base, &amdkfd_fence_ops, &fence->lock,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
index f6b7522c3c82..046243e3a3cd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c@@ -128,7 +128,7 @@ int amdgpu_evf_mgr_rearm(struct amdgpu_eviction_fence_mgr *evf_mgr, return -ENOMEM; ev_fence->evf_mgr = evf_mgr; - get_task_comm(ev_fence->timeline_name, current); + strscpy_pad(ev_fence->timeline_name, current->comm); spin_lock_init(&ev_fence->lock); dma_fence_init64(&ev_fence->base, &amdgpu_eviction_fence_ops, &ev_fence->lock, evf_mgr->ev_fence_ctx,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 35eb87591740..6f140025a5f3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c@@ -3687,7 +3687,7 @@ int amdgpu_ras_init(struct amdgpu_device *adev) } con->init_task_pid = task_pid_nr(current); - get_task_comm(con->init_task_comm, current); + strscpy_pad(con->init_task_comm, current->comm); mutex_init(&con->critical_region_lock); INIT_LIST_HEAD(&con->critical_region_head);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
index 7e80442ec3e5..cd4d1aef97c0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c@@ -85,7 +85,7 @@ int amdgpu_userq_fence_driver_alloc(struct amdgpu_device *adev, fence_drv->adev = adev; fence_drv->context = dma_fence_context_alloc(1); - get_task_comm(fence_drv->timeline_name, current); + strscpy_pad(fence_drv->timeline_name, current->comm); *fence_drv_req = fence_drv;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index d2ad5b0e8759..017e9b27c336 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c@@ -2572,10 +2572,10 @@ void amdgpu_vm_set_task_info(struct amdgpu_vm *vm) return; vm->task_info->task.pid = current->pid; - get_task_comm(vm->task_info->task.comm, current); + strscpy_pad(vm->task_info->task.comm, current->comm); vm->task_info->tgid = current->tgid; - get_task_comm(vm->task_info->process_name, current->group_leader); + strscpy_pad(vm->task_info->process_name, current->group_leader->comm); } /**
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index 249f07f30951..d6f32bc44aef 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c@@ -565,7 +565,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man, } vres->task.pid = task_pid_nr(current); - get_task_comm(vres->task.comm, current); + strscpy_pad(vres->task.comm, current->comm); list_add_tail(&vres->vres_node, &mgr->allocated_vres_list); if (bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS && adjust_dcc_size) {
diff --git a/drivers/gpu/drm/lima/lima_ctx.c b/drivers/gpu/drm/lima/lima_ctx.c
index 68ede7a725e2..e8c5c3601bf1 100644
--- a/drivers/gpu/drm/lima/lima_ctx.c
+++ b/drivers/gpu/drm/lima/lima_ctx.c@@ -29,7 +29,7 @@ int lima_ctx_create(struct lima_device *dev, struct lima_ctx_mgr *mgr, u32 *id) goto err_out0; ctx->pid = task_pid_nr(current); - get_task_comm(ctx->pname, current); + strscpy_pad(ctx->pname, current->comm); return 0;
diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c
index 3a7fce428898..11936c4d3573 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gem.c
+++ b/drivers/gpu/drm/panfrost/panfrost_gem.c@@ -36,7 +36,7 @@ static void panfrost_gem_debugfs_bo_add(struct panfrost_device *pfdev, struct panfrost_gem_object *bo) { bo->debugfs.creator.tgid = current->tgid; - get_task_comm(bo->debugfs.creator.process_name, current->group_leader); + strscpy_pad(bo->debugfs.creator.process_name, current->group_leader->comm); mutex_lock(&pfdev->debugfs.gems_lock); list_add_tail(&bo->debugfs.node, &pfdev->debugfs.gems_list);
diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
index b090b01211ad..8ffc6cef7100 100644
--- a/drivers/gpu/drm/panthor/panthor_gem.c
+++ b/drivers/gpu/drm/panthor/panthor_gem.c@@ -54,7 +54,7 @@ static void panthor_gem_debugfs_bo_add(struct panthor_gem_object *bo) struct panthor_device, base); bo->debugfs.creator.tgid = current->tgid; - get_task_comm(bo->debugfs.creator.process_name, current->group_leader); + strscpy_pad(bo->debugfs.creator.process_name, current->group_leader->comm); mutex_lock(&ptdev->gems.lock); list_add_tail(&bo->debugfs.node, &ptdev->gems.node);
diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
index 5778e23e20a0..1702b12ee395 100644
--- a/drivers/gpu/drm/panthor/panthor_sched.c
+++ b/drivers/gpu/drm/panthor/panthor_sched.c@@ -3617,7 +3617,7 @@ static void group_init_task_info(struct panthor_group *group) struct task_struct *task = current->group_leader; group->task_info.pid = task->pid; - get_task_comm(group->task_info.comm, task); + strscpy_pad(group->task_info.comm, task->comm); } static void add_group_kbo_sizes(struct panthor_device *ptdev,
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 3d8e4ccdb7c1..b10a0e1cb1ed 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c@@ -50,7 +50,7 @@ static void virtio_gpu_create_context_locked(struct virtio_gpu_device *vgdev, } else { char dbgname[TASK_COMM_LEN]; - get_task_comm(dbgname, current); + strscpy_pad(dbgname, current->comm); virtio_gpu_cmd_context_create(vgdev, vfpriv->ctx_id, vfpriv->context_init, strlen(dbgname), dbgname);
diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index f48c6a8a0654..c7715439964e 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c@@ -634,7 +634,7 @@ static ssize_t stm_char_write(struct file *file, const char __user *buf, char comm[sizeof(current->comm)]; char *ids[] = { comm, "default", NULL }; - get_task_comm(comm, current); + strscpy_pad(comm, current->comm); err = stm_assign_first_policy(stmf->stm, &stmf->output, ids, 1); /*
diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c
index d014af6ab060..d514a81d0a5c 100644
--- a/drivers/tty/tty_audit.c
+++ b/drivers/tty/tty_audit.c@@ -77,7 +77,7 @@ static void tty_audit_log(const char *description, dev_t dev, audit_log_format(ab, "%s pid=%u uid=%u auid=%u ses=%u major=%d minor=%d comm=", description, pid, uid, loginuid, sessionid, MAJOR(dev), MINOR(dev)); - get_task_comm(name, current); + strscpy_pad(name, current->comm); audit_log_untrustedstring(ab, name); audit_log_format(ab, " data="); audit_log_n_hex(ab, data, size);
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 06d0df105382..a47d393a10b5 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c@@ -1554,7 +1554,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p, SET_UID(psinfo->pr_uid, from_kuid_munged(cred->user_ns, cred->uid)); SET_GID(psinfo->pr_gid, from_kgid_munged(cred->user_ns, cred->gid)); rcu_read_unlock(); - get_task_comm(psinfo->pr_fname, p); + strscpy_pad(psinfo->pr_fname, p->comm); return 0; }
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 068c46875c74..76333fa2f949 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c@@ -1376,7 +1376,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p, SET_UID(psinfo->pr_uid, from_kuid_munged(cred->user_ns, cred->uid)); SET_GID(psinfo->pr_gid, from_kgid_munged(cred->user_ns, cred->gid)); rcu_read_unlock(); - get_task_comm(psinfo->pr_fname, p); + strscpy_pad(psinfo->pr_fname, p->comm); return 0; }
diff --git a/fs/proc/array.c b/fs/proc/array.c
index f6f75d206762..8ebb7cf1a7b0 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c@@ -110,7 +110,7 @@ void proc_task_name(struct seq_file *m, struct task_struct *p, bool escape) else if (p->flags & PF_KTHREAD) get_kthread_comm(tcomm, sizeof(tcomm), p); else - get_task_comm(tcomm, p); + strscpy_pad(tcomm, p->comm); if (escape) seq_escape_str(m, tcomm, ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\");
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c7cdbb3e4aa6..474ca86ec105 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h@@ -2035,25 +2035,6 @@ extern void __set_task_comm(struct task_struct *tsk, const char *from, bool exec __set_task_comm(tsk, from, false); \ }) -/* - * - Why not use task_lock()? - * User space can randomly change their names anyway, so locking for readers - * doesn't make sense. For writers, locking is probably necessary, as a race - * condition could lead to long-term mixed results. - * The strscpy_pad() in __set_task_comm() can ensure that the task comm is - * always NUL-terminated and zero-padded. Therefore the race condition between - * reader and writer is not an issue. - * - * - BUILD_BUG_ON() can help prevent the buf from being truncated. - * Since the callers don't perform any return value checks, this safeguard is - * necessary. - */ -#define get_task_comm(buf, tsk) ({ \ - BUILD_BUG_ON(sizeof(buf) < TASK_COMM_LEN); \ - strscpy_pad(buf, (tsk)->comm); \ - buf; \ -}) - static __always_inline void scheduler_ipi(void) { /*
diff --git a/kernel/audit.c b/kernel/audit.c
index 9412af9144bc..75bcc0d43c55 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c@@ -1667,7 +1667,8 @@ static void audit_log_multicast(int group, const char *op, int err) audit_put_tty(tty); audit_log_task_context(ab); /* subj= */ audit_log_format(ab, " comm="); - audit_log_untrustedstring(ab, get_task_comm(comm, current)); + strscpy_pad(comm, current->comm); + audit_log_untrustedstring(ab, comm); audit_log_d_path_exe(ab, current->mm); /* exe= */ audit_log_format(ab, " nl-mcgrp=%d op=%s res=%d", group, op, !err); audit_log_end(ab);
@@ -2483,7 +2484,8 @@ void audit_log_task_info(struct audit_buffer *ab) audit_get_sessionid(current)); audit_put_tty(tty); audit_log_format(ab, " comm="); - audit_log_untrustedstring(ab, get_task_comm(comm, current)); + strscpy_pad(comm, current->comm); + audit_log_untrustedstring(ab, comm); audit_log_d_path_exe(ab, current->mm); audit_log_task_context(ab); }
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 2b9ce0b52511..79e2aae80685 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c@@ -2878,7 +2878,8 @@ void __audit_log_nfcfg(const char *name, u8 af, unsigned int nentries, audit_log_format(ab, " pid=%u", task_tgid_nr(current)); audit_log_task_context(ab); /* subj= */ audit_log_format(ab, " comm="); - audit_log_untrustedstring(ab, get_task_comm(comm, current)); + strscpy_pad(comm, current->comm); + audit_log_untrustedstring(ab, comm); audit_log_end(ab); } EXPORT_SYMBOL_GPL(__audit_log_nfcfg);
@@ -2901,7 +2902,8 @@ static void audit_log_task(struct audit_buffer *ab) sessionid); audit_log_task_context(ab); audit_log_format(ab, " pid=%d comm=", task_tgid_nr(current)); - audit_log_untrustedstring(ab, get_task_comm(comm, current)); + strscpy_pad(comm, current->comm); + audit_log_untrustedstring(ab, comm); audit_log_d_path_exe(ab, current->mm); }
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 3fcdf4b4e2e5..bfe1de723d93 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c@@ -2247,7 +2247,7 @@ static u16 printk_sprint(char *text, u16 size, int facility, static void printk_store_execution_ctx(struct printk_info *info) { info->caller_id2 = printk_caller_id2(); - get_task_comm(info->comm, current); + strscpy_pad(info->comm, current->comm); } static void pmsg_load_execution_ctx(struct printk_message *pmsg,
diff --git a/kernel/sys.c b/kernel/sys.c
index 35b538ba843c..97df708c11a0 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c@@ -2609,7 +2609,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, proc_comm_connector(me); break; case PR_GET_NAME: - get_task_comm(comm, me); + strscpy_pad(comm, me->comm); if (copy_to_user((char __user *)arg2, comm, sizeof(comm))) return -EFAULT; break;
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 070ca388f9ac..4e66cb2d9549 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c@@ -104,7 +104,7 @@ static bool hci_sock_gen_cookie(struct sock *sk) id = 0xffffffff; hci_pi(sk)->cookie = id; - get_task_comm(hci_pi(sk)->comm, current); + strscpy_pad(hci_pi(sk)->comm, current->comm); return true; }
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index af357f6c5070..f5f65f86aecc 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c@@ -9723,9 +9723,11 @@ static int nf_tables_fill_gen_info(struct sk_buff *skb, struct net *net, if (!nlh) goto nla_put_failure; + strscpy_pad(buf, current->comm); + if (nla_put_be32(skb, NFTA_GEN_ID, htonl(nft_base_seq(net))) || nla_put_be32(skb, NFTA_GEN_PROC_PID, htonl(task_pid_nr(current))) || - nla_put_string(skb, NFTA_GEN_PROC_NAME, get_task_comm(buf, current))) + nla_put_string(skb, NFTA_GEN_PROC_NAME, buf)) goto nla_put_failure; nlmsg_end(skb, nlh);
diff --git a/security/integrity/integrity_audit.c b/security/integrity/integrity_audit.c
index d8d9e5ff1cd2..98060060929d 100644
--- a/security/integrity/integrity_audit.c
+++ b/security/integrity/integrity_audit.c@@ -54,7 +54,8 @@ void integrity_audit_message(int audit_msgno, struct inode *inode, audit_get_sessionid(current)); audit_log_task_context(ab); audit_log_format(ab, " op=%s cause=%s comm=", op, cause); - audit_log_untrustedstring(ab, get_task_comm(name, current)); + strscpy_pad(name, current->comm); + audit_log_untrustedstring(ab, name); if (fname) { audit_log_format(ab, " name="); audit_log_untrustedstring(ab, fname);
diff --git a/security/ipe/audit.c b/security/ipe/audit.c
index 93fb59fbddd6..90a6acfb7cdf 100644
--- a/security/ipe/audit.c
+++ b/security/ipe/audit.c@@ -145,7 +145,8 @@ void ipe_audit_match(const struct ipe_eval_ctx *const ctx, audit_log_format(ab, "ipe_op=%s ipe_hook=%s enforcing=%d pid=%d comm=", op, audit_hook_names[ctx->hook], READ_ONCE(enforce), task_tgid_nr(current)); - audit_log_untrustedstring(ab, get_task_comm(comm, current)); + strscpy_pad(comm, current->comm); + audit_log_untrustedstring(ab, comm); if (ctx->file) { audit_log_d_path(ab, " path=", &ctx->file->f_path);
diff --git a/security/landlock/domain.c b/security/landlock/domain.c
index 93c7104fd6b2..dd997391df0e 100644
--- a/security/landlock/domain.c
+++ b/security/landlock/domain.c@@ -562,7 +562,7 @@ static struct landlock_details *get_current_details(void) memcpy(details->exe_path, path_str, path_size); details->pid = get_pid(task_tgid(current)); details->uid = from_kuid(&init_user_ns, current_uid()); - get_task_comm(details->comm, current); + strscpy_pad(details->comm, current->comm); return details; }
diff --git a/security/lsm_audit.c b/security/lsm_audit.c
index 737f5a263a8f..a587ffecd985 100644
--- a/security/lsm_audit.c
+++ b/security/lsm_audit.c@@ -276,8 +276,8 @@ void audit_log_lsm_data(struct audit_buffer *ab, if (pid) { char tskcomm[sizeof(tsk->comm)]; audit_log_format(ab, " opid=%d ocomm=", pid); - audit_log_untrustedstring(ab, - get_task_comm(tskcomm, tsk)); + strscpy_pad(tskcomm, tsk->comm); + audit_log_untrustedstring(ab, tskcomm); } } break;
@@ -417,7 +417,8 @@ static void dump_common_audit_data(struct audit_buffer *ab, char comm[sizeof(current->comm)]; audit_log_format(ab, " pid=%d comm=", task_tgid_nr(current)); - audit_log_untrustedstring(ab, get_task_comm(comm, current)); + strscpy_pad(comm, current->comm); + audit_log_untrustedstring(ab, comm); audit_log_lsm_data(ab, a); }
--
2.55.0