AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/07/17 20:53 flow patch-triage
0m Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [
    "sys_prctl"
  ],
  "Reasoning": "The patch adds new prctl options PR_SET_EXT_NAME and PR_GET_EXT_NAME to set and get extended process names, which is a functional change reachable from userspace and should be fuzzed.",
  "WorthFuzzing": true
}

1/1 2026/07/17 20:53 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 6de54c3decb3c13f294ea911e9c8cedccf2efd29\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Fri Jul 17 20:53:23 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c\nindex 0056ab81fbc39a..c78243ed3c2a96 100644\n--- a/drivers/connector/cn_proc.c\n+++ b/drivers/connector/cn_proc.c\n@@ -278,7 +278,7 @@ void proc_comm_connector(struct task_struct *task)\n \tev-\u003ewhat = PROC_EVENT_COMM;\n \tev-\u003eevent_data.comm.process_pid  = task-\u003epid;\n \tev-\u003eevent_data.comm.process_tgid = task-\u003etgid;\n-\tget_task_comm(ev-\u003eevent_data.comm.comm, task);\n+\tstrscpy_pad(ev-\u003eevent_data.comm.comm, task-\u003ecomm);\n \n \tmemcpy(\u0026msg-\u003eid, \u0026cn_proc_event_id, sizeof(msg-\u003eid));\n \tmsg-\u003eack = 0; /* not used */\ndiff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c\nindex 8df20b0218a9ee..d501657ad80129 100644\n--- a/drivers/dma-buf/sw_sync.c\n+++ b/drivers/dma-buf/sw_sync.c\n@@ -312,7 +312,7 @@ static int sw_sync_debugfs_open(struct inode *inode, struct file *file)\n \tstruct sync_timeline *obj;\n \tchar task_comm[TASK_COMM_LEN];\n \n-\tget_task_comm(task_comm, current);\n+\tstrscpy_pad(task_comm, current-\u003ecomm);\n \n \tobj = sync_timeline_create(task_comm);\n \tif (!obj)\ndiff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c\nindex 6a364357522b8a..13c8857e4ffba1 100644\n--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c\n+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c\n@@ -74,7 +74,7 @@ struct amdgpu_amdkfd_fence *amdgpu_amdkfd_fence_create(u64 context,\n \t/* This reference gets released in amdkfd_fence_release */\n \tmmgrab(mm);\n \tfence-\u003emm = mm;\n-\tget_task_comm(fence-\u003etimeline_name, current);\n+\tstrscpy_pad(fence-\u003etimeline_name, current-\u003ecomm);\n \tspin_lock_init(\u0026fence-\u003elock);\n \tfence-\u003esvm_bo = svm_bo;\n \tfence-\u003econtext_id = context_id;\ndiff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c\nindex f6b7522c3c82ff..046243e3a3cd03 100644\n--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c\n+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c\n@@ -128,7 +128,7 @@ int amdgpu_evf_mgr_rearm(struct amdgpu_eviction_fence_mgr *evf_mgr,\n \t\treturn -ENOMEM;\n \n \tev_fence-\u003eevf_mgr = evf_mgr;\n-\tget_task_comm(ev_fence-\u003etimeline_name, current);\n+\tstrscpy_pad(ev_fence-\u003etimeline_name, current-\u003ecomm);\n \tspin_lock_init(\u0026ev_fence-\u003elock);\n \tdma_fence_init64(\u0026ev_fence-\u003ebase, \u0026amdgpu_eviction_fence_ops,\n \t\t\t \u0026ev_fence-\u003elock, evf_mgr-\u003eev_fence_ctx,\ndiff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c\nindex 764cd49504083c..e60a470b57ecc1 100644\n--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c\n+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c\n@@ -4445,7 +4445,7 @@ int amdgpu_ras_init(struct amdgpu_device *adev)\n \t}\n \n \tcon-\u003einit_task_pid = task_pid_nr(current);\n-\tget_task_comm(con-\u003einit_task_comm, current);\n+\tstrscpy_pad(con-\u003einit_task_comm, current-\u003ecomm);\n \n \tmutex_init(\u0026con-\u003ecritical_region_lock);\n \tINIT_LIST_HEAD(\u0026con-\u003ecritical_region_head);\ndiff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c\nindex f74ad378e40742..f41857473641bc 100644\n--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c\n+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c\n@@ -85,7 +85,7 @@ int amdgpu_userq_fence_driver_alloc(struct amdgpu_device *adev,\n \n \tfence_drv-\u003eadev = adev;\n \tfence_drv-\u003econtext = dma_fence_context_alloc(1);\n-\tget_task_comm(fence_drv-\u003etimeline_name, current);\n+\tstrscpy_pad(fence_drv-\u003etimeline_name, current-\u003ecomm);\n \n \t*fence_drv_req = fence_drv;\n \ndiff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c\nindex bb99b7c3a010ea..84c0b310e9c147 100644\n--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c\n+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c\n@@ -2542,10 +2542,10 @@ void amdgpu_vm_set_task_info(struct amdgpu_vm *vm)\n \t\treturn;\n \n \tvm-\u003etask_info-\u003etask.pid = current-\u003epid;\n-\tget_task_comm(vm-\u003etask_info-\u003etask.comm, current);\n+\tstrscpy_pad(vm-\u003etask_info-\u003etask.comm, current-\u003ecomm);\n \n \tvm-\u003etask_info-\u003etgid = current-\u003etgid;\n-\tget_task_comm(vm-\u003etask_info-\u003eprocess_name, current-\u003egroup_leader);\n+\tstrscpy_pad(vm-\u003etask_info-\u003eprocess_name, current-\u003egroup_leader-\u003ecomm);\n }\n \n /**\ndiff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c\nindex 2a241a5b12c420..f8ce59d8587a1f 100644\n--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c\n+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c\n@@ -563,7 +563,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,\n \t}\n \n \tvres-\u003etask.pid = task_pid_nr(current);\n-\tget_task_comm(vres-\u003etask.comm, current);\n+\tstrscpy_pad(vres-\u003etask.comm, current-\u003ecomm);\n \tlist_add_tail(\u0026vres-\u003evres_node, \u0026mgr-\u003eallocated_vres_list);\n \n \tif (bo-\u003eflags \u0026 AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS \u0026\u0026 adjust_dcc_size) {\ndiff --git a/drivers/gpu/drm/lima/lima_ctx.c b/drivers/gpu/drm/lima/lima_ctx.c\nindex 68ede7a725e219..e8c5c3601bf1d5 100644\n--- a/drivers/gpu/drm/lima/lima_ctx.c\n+++ b/drivers/gpu/drm/lima/lima_ctx.c\n@@ -29,7 +29,7 @@ int lima_ctx_create(struct lima_device *dev, struct lima_ctx_mgr *mgr, u32 *id)\n \t\tgoto err_out0;\n \n \tctx-\u003epid = task_pid_nr(current);\n-\tget_task_comm(ctx-\u003epname, current);\n+\tstrscpy_pad(ctx-\u003epname, current-\u003ecomm);\n \n \treturn 0;\n \ndiff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c\nindex 3a7fce4288987b..11936c4d35736b 100644\n--- a/drivers/gpu/drm/panfrost/panfrost_gem.c\n+++ b/drivers/gpu/drm/panfrost/panfrost_gem.c\n@@ -36,7 +36,7 @@ static void panfrost_gem_debugfs_bo_add(struct panfrost_device *pfdev,\n \t\t\t\t\tstruct panfrost_gem_object *bo)\n {\n \tbo-\u003edebugfs.creator.tgid = current-\u003etgid;\n-\tget_task_comm(bo-\u003edebugfs.creator.process_name, current-\u003egroup_leader);\n+\tstrscpy_pad(bo-\u003edebugfs.creator.process_name, current-\u003egroup_leader-\u003ecomm);\n \n \tmutex_lock(\u0026pfdev-\u003edebugfs.gems_lock);\n \tlist_add_tail(\u0026bo-\u003edebugfs.node, \u0026pfdev-\u003edebugfs.gems_list);\ndiff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c\nindex a1e2eb1ca7bbe6..ebb3664e4303cc 100644\n--- a/drivers/gpu/drm/panthor/panthor_gem.c\n+++ b/drivers/gpu/drm/panthor/panthor_gem.c\n@@ -54,7 +54,7 @@ static void panthor_gem_debugfs_bo_add(struct panthor_gem_object *bo)\n \t\t\t\t\t\t    struct panthor_device, base);\n \n \tbo-\u003edebugfs.creator.tgid = current-\u003etgid;\n-\tget_task_comm(bo-\u003edebugfs.creator.process_name, current-\u003egroup_leader);\n+\tstrscpy_pad(bo-\u003edebugfs.creator.process_name, current-\u003egroup_leader-\u003ecomm);\n \n \tmutex_lock(\u0026ptdev-\u003egems.lock);\n \tlist_add_tail(\u0026bo-\u003edebugfs.node, \u0026ptdev-\u003egems.node);\ndiff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c\nindex 298b046c95edb8..81c4659c0d7be9 100644\n--- a/drivers/gpu/drm/panthor/panthor_sched.c\n+++ b/drivers/gpu/drm/panthor/panthor_sched.c\n@@ -3617,7 +3617,7 @@ static void group_init_task_info(struct panthor_group *group)\n \tstruct task_struct *task = current-\u003egroup_leader;\n \n \tgroup-\u003etask_info.pid = task-\u003epid;\n-\tget_task_comm(group-\u003etask_info.comm, task);\n+\tstrscpy_pad(group-\u003etask_info.comm, task-\u003ecomm);\n }\n \n static void add_group_kbo_sizes(struct panthor_device *ptdev,\ndiff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c\nindex 3d8e4ccdb7c1f8..b10a0e1cb1ed70 100644\n--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c\n+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c\n@@ -50,7 +50,7 @@ static void virtio_gpu_create_context_locked(struct virtio_gpu_device *vgdev,\n \t} else {\n \t\tchar dbgname[TASK_COMM_LEN];\n \n-\t\tget_task_comm(dbgname, current);\n+\t\tstrscpy_pad(dbgname, current-\u003ecomm);\n \t\tvirtio_gpu_cmd_context_create(vgdev, vfpriv-\u003ectx_id,\n \t\t\t\t\t      vfpriv-\u003econtext_init, strlen(dbgname),\n \t\t\t\t\t      dbgname);\ndiff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c\nindex f48c6a8a0654e9..c7715439964e81 100644\n--- a/drivers/hwtracing/stm/core.c\n+++ b/drivers/hwtracing/stm/core.c\n@@ -634,7 +634,7 @@ static ssize_t stm_char_write(struct file *file, const char __user *buf,\n \t\tchar comm[sizeof(current-\u003ecomm)];\n \t\tchar *ids[] = { comm, \"default\", NULL };\n \n-\t\tget_task_comm(comm, current);\n+\t\tstrscpy_pad(comm, current-\u003ecomm);\n \n \t\terr = stm_assign_first_policy(stmf-\u003estm, \u0026stmf-\u003eoutput, ids, 1);\n \t\t/*\ndiff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c\nindex d014af6ab060e5..d514a81d0a5c8e 100644\n--- a/drivers/tty/tty_audit.c\n+++ b/drivers/tty/tty_audit.c\n@@ -77,7 +77,7 @@ static void tty_audit_log(const char *description, dev_t dev,\n \taudit_log_format(ab, \"%s pid=%u uid=%u auid=%u ses=%u major=%d minor=%d comm=\",\n \t\t\t description, pid, uid, loginuid, sessionid,\n \t\t\t MAJOR(dev), MINOR(dev));\n-\tget_task_comm(name, current);\n+\tstrscpy_pad(name, current-\u003ecomm);\n \taudit_log_untrustedstring(ab, name);\n \taudit_log_format(ab, \" data=\");\n \taudit_log_n_hex(ab, data, size);\ndiff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c\nindex 16a56b6b3f6ca1..d25922460b6378 100644\n--- a/fs/binfmt_elf.c\n+++ b/fs/binfmt_elf.c\n@@ -1557,7 +1557,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,\n \tSET_UID(psinfo-\u003epr_uid, from_kuid_munged(cred-\u003euser_ns, cred-\u003euid));\n \tSET_GID(psinfo-\u003epr_gid, from_kgid_munged(cred-\u003euser_ns, cred-\u003egid));\n \trcu_read_unlock();\n-\tget_task_comm(psinfo-\u003epr_fname, p);\n+\tstrscpy_pad(psinfo-\u003epr_fname, p-\u003ecomm);\n \n \treturn 0;\n }\ndiff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c\nindex 7e3108489c83ca..c4d4e59ff34d1b 100644\n--- a/fs/binfmt_elf_fdpic.c\n+++ b/fs/binfmt_elf_fdpic.c\n@@ -1371,7 +1371,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,\n \tSET_UID(psinfo-\u003epr_uid, from_kuid_munged(cred-\u003euser_ns, cred-\u003euid));\n \tSET_GID(psinfo-\u003epr_gid, from_kgid_munged(cred-\u003euser_ns, cred-\u003egid));\n \trcu_read_unlock();\n-\tget_task_comm(psinfo-\u003epr_fname, p);\n+\tstrscpy_pad(psinfo-\u003epr_fname, p-\u003ecomm);\n \n \treturn 0;\n }\ndiff --git a/fs/proc/array.c b/fs/proc/array.c\nindex 479ea8cb4ef43d..0490b9ef278850 100644\n--- a/fs/proc/array.c\n+++ b/fs/proc/array.c\n@@ -110,7 +110,7 @@ void proc_task_name(struct seq_file *m, struct task_struct *p, bool escape)\n \telse if (p-\u003eflags \u0026 PF_KTHREAD)\n \t\tget_kthread_comm(tcomm, sizeof(tcomm), p);\n \telse\n-\t\tget_task_comm(tcomm, p);\n+\t\tstrscpy_pad(tcomm, p-\u003ecomm, TASK_COMM_LEN);\n \n \tif (escape)\n \t\tseq_escape_str(m, tcomm, ESCAPE_SPACE | ESCAPE_SPECIAL, \"\\n\\\\\");\ndiff --git a/include/linux/coredump.h b/include/linux/coredump.h\nindex 7b38ee2e7913be..dee82e3c350af5 100644\n--- a/include/linux/coredump.h\n+++ b/include/linux/coredump.h\n@@ -58,7 +58,7 @@ extern void vfs_coredump(const kernel_siginfo_t *siginfo);\n \tdo {\t\\\n \t\tchar comm[TASK_COMM_LEN];\t\\\n \t\t/* This will always be NUL terminated. */ \\\n-\t\tmemcpy(comm, current-\u003ecomm, sizeof(comm)); \\\n+\t\tcopy_task_comm(comm, current, sizeof(comm)); \\\n \t\tprintk_ratelimited(Level \"coredump: %d(%*pE): \" Format \"\\n\",\t\\\n \t\t\ttask_tgid_vnr(current), (int)strlen(comm), comm, ##__VA_ARGS__);\t\\\n \t} while (0)\t\\\ndiff --git a/include/linux/sched.h b/include/linux/sched.h\nindex 373bcc0598d10b..0f1b40a5dbc60b 100644\n--- a/include/linux/sched.h\n+++ b/include/linux/sched.h\n@@ -323,6 +323,7 @@ struct user_event_mm;\n  */\n enum {\n \tTASK_COMM_LEN = 16,\n+\tTASK_COMM_EXT_LEN = 64,\n };\n \n extern void sched_tick(void);\n@@ -1178,7 +1179,7 @@ struct task_struct {\n \t * - set it with set_task_comm() to ensure it is always\n \t *   NUL-terminated and zero-padded\n \t */\n-\tchar\t\t\t\tcomm[TASK_COMM_LEN];\n+\tchar\t\t\t\tcomm[TASK_COMM_EXT_LEN];\n \n \tstruct nameidata\t\t*nameidata;\n \n@@ -2017,28 +2018,20 @@ extern void kick_process(struct task_struct *tsk);\n \n extern void __set_task_comm(struct task_struct *tsk, const char *from, bool exec);\n #define set_task_comm(tsk, from) ({\t\t\t\\\n-\tBUILD_BUG_ON(sizeof(from) != TASK_COMM_LEN);\t\\\n+\tBUILD_BUG_ON(sizeof(from) \u003c TASK_COMM_LEN);\t\\\n \t__set_task_comm(tsk, from, false);\t\t\\\n })\n \n /*\n- * - Why not use task_lock()?\n- *   User space can randomly change their names anyway, so locking for readers\n- *   doesn't make sense. For writers, locking is probably necessary, as a race\n- *   condition could lead to long-term mixed results.\n- *   The strscpy_pad() in __set_task_comm() can ensure that the task comm is\n- *   always NUL-terminated and zero-padded. Therefore the race condition between\n- *   reader and writer is not an issue.\n- *\n- * - BUILD_BUG_ON() can help prevent the buf from being truncated.\n- *   Since the callers don't perform any return value checks, this safeguard is\n- *   necessary.\n+ * Copy task name to a buffer. Final result is always a NUL-terminated string.\n  */\n-#define get_task_comm(buf, tsk) ({\t\t\t\\\n-\tBUILD_BUG_ON(sizeof(buf) \u003c TASK_COMM_LEN);\t\\\n-\tstrscpy_pad(buf, (tsk)-\u003ecomm);\t\t\t\\\n-\tbuf;\t\t\t\t\t\t\\\n-})\n+static __always_inline void copy_task_comm(char *dst, struct task_struct *tsk, size_t len)\n+{\n+\tconst char *_src = tsk-\u003ecomm;\n+\n+\tmemcpy(dst, _src, len);\n+\tdst[len - 1] = '\\0';\n+}\n \n static __always_inline void scheduler_ipi(void)\n {\ndiff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h\nindex e0d838c9ce9382..9b0094fa44c649 100644\n--- a/include/linux/tracepoint.h\n+++ b/include/linux/tracepoint.h\n@@ -637,10 +637,10 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)\n  *\t*\n  *\n  *\tTP_fast_assign(\n- *\t\tmemcpy(__entry-\u003enext_comm, next-\u003ecomm, TASK_COMM_LEN);\n+ *\t\tcopy_task_comm(__entry-\u003enext_comm, next, TASK_COMM_LEN);\n  *\t\t__entry-\u003eprev_pid\t= prev-\u003epid;\n  *\t\t__entry-\u003eprev_prio\t= prev-\u003eprio;\n- *\t\tmemcpy(__entry-\u003eprev_comm, prev-\u003ecomm, TASK_COMM_LEN);\n+ *\t\tcopy_task_comm(__entry-\u003eprev_comm, prev, TASK_COMM_LEN);\n  *\t\t__entry-\u003enext_pid\t= next-\u003epid;\n  *\t\t__entry-\u003enext_prio\t= next-\u003eprio;\n  *\t),\ndiff --git a/include/trace/events/block.h b/include/trace/events/block.h\nindex 9c97a16850b922..1e3a9ded03bd4f 100644\n--- a/include/trace/events/block.h\n+++ b/include/trace/events/block.h\n@@ -213,7 +213,7 @@ DECLARE_EVENT_CLASS(block_rq,\n \n \t\tblk_fill_rwbs(__entry-\u003erwbs, rq-\u003ecmd_flags);\n \t\t__get_str(cmd)[0] = '\\0';\n-\t\tmemcpy(__entry-\u003ecomm, current-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003ecomm, current, TASK_COMM_LEN);\n \t),\n \n \tTP_printk(\"%d,%d %s %u (%s) %llu + %u %s,%u,%u [%s]\",\n@@ -410,7 +410,7 @@ DECLARE_EVENT_CLASS(block_bio,\n \t\t__entry-\u003esector\t\t= bio-\u003ebi_iter.bi_sector;\n \t\t__entry-\u003enr_sector\t= bio_sectors(bio);\n \t\tblk_fill_rwbs(__entry-\u003erwbs, bio-\u003ebi_opf);\n-\t\tmemcpy(__entry-\u003ecomm, current-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003ecomm, current, TASK_COMM_LEN);\n \t),\n \n \tTP_printk(\"%d,%d %s %llu + %u [%s]\",\n@@ -493,7 +493,7 @@ TRACE_EVENT(block_plug,\n \t),\n \n \tTP_fast_assign(\n-\t\tmemcpy(__entry-\u003ecomm, current-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003ecomm, current, TASK_COMM_LEN);\n \t),\n \n \tTP_printk(\"[%s]\", __entry-\u003ecomm)\n@@ -512,7 +512,7 @@ DECLARE_EVENT_CLASS(block_unplug,\n \n \tTP_fast_assign(\n \t\t__entry-\u003enr_rq = depth;\n-\t\tmemcpy(__entry-\u003ecomm, current-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003ecomm, current, TASK_COMM_LEN);\n \t),\n \n \tTP_printk(\"[%s] %d\", __entry-\u003ecomm, __entry-\u003enr_rq)\n@@ -563,7 +563,7 @@ TRACE_EVENT(block_split,\n \t\t__entry-\u003esector\t\t= bio-\u003ebi_iter.bi_sector;\n \t\t__entry-\u003enew_sector\t= new_sector;\n \t\tblk_fill_rwbs(__entry-\u003erwbs, bio-\u003ebi_opf);\n-\t\tmemcpy(__entry-\u003ecomm, current-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003ecomm, current, TASK_COMM_LEN);\n \t),\n \n \tTP_printk(\"%d,%d %s %llu / %llu [%s]\",\ndiff --git a/include/trace/events/coredump.h b/include/trace/events/coredump.h\nindex c7b9c53fc49869..fdd20bc46bb027 100644\n--- a/include/trace/events/coredump.h\n+++ b/include/trace/events/coredump.h\n@@ -32,7 +32,7 @@ TRACE_EVENT(coredump,\n \n \tTP_fast_assign(\n \t\t__entry-\u003esig = sig;\n-\t\tmemcpy(__entry-\u003ecomm, current-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003ecomm, current, TASK_COMM_LEN);\n \t),\n \n \tTP_printk(\"sig=%d comm=%s\",\ndiff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h\nindex 270c1a2c24c44a..7d22650b4c785f 100644\n--- a/include/trace/events/f2fs.h\n+++ b/include/trace/events/f2fs.h\n@@ -2505,7 +2505,7 @@ TRACE_EVENT(f2fs_lock_elapsed_time,\n \n \tTP_fast_assign(\n \t\t__entry-\u003edev\t\t= sbi-\u003esb-\u003es_dev;\n-\t\tmemcpy(__entry-\u003ecomm, p-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003ecomm, p, TASK_COMM_LEN);\n \t\t__entry-\u003epid\t\t= p-\u003epid;\n \t\t__entry-\u003eprio\t\t= p-\u003eprio;\n \t\t__entry-\u003eioprio_class\t= IOPRIO_PRIO_CLASS(ioprio);\n@@ -2558,7 +2558,7 @@ DECLARE_EVENT_CLASS(f2fs_priority_update,\n \n \tTP_fast_assign(\n \t\t__entry-\u003edev\t\t= sbi-\u003esb-\u003es_dev;\n-\t\tmemcpy(__entry-\u003ecomm, p-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003ecomm, p, TASK_COMM_LEN);\n \t\t__entry-\u003epid\t\t= p-\u003epid;\n \t\t__entry-\u003elock_name\t= lock_name;\n \t\t__entry-\u003eis_write\t= is_write;\ndiff --git a/include/trace/events/oom.h b/include/trace/events/oom.h\nindex 9f0a5d1482c448..8bcdc4ffc8d344 100644\n--- a/include/trace/events/oom.h\n+++ b/include/trace/events/oom.h\n@@ -23,7 +23,7 @@ TRACE_EVENT(oom_score_adj_update,\n \n \tTP_fast_assign(\n \t\t__entry-\u003epid = task-\u003epid;\n-\t\tmemcpy(__entry-\u003ecomm, task-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003ecomm, task, TASK_COMM_LEN);\n \t\t__entry-\u003eoom_score_adj = task-\u003esignal-\u003eoom_score_adj;\n \t),\n \ndiff --git a/include/trace/events/osnoise.h b/include/trace/events/osnoise.h\nindex 3f42736238014e..2cf047bb9fb71d 100644\n--- a/include/trace/events/osnoise.h\n+++ b/include/trace/events/osnoise.h\n@@ -116,7 +116,7 @@ TRACE_EVENT(thread_noise,\n \t),\n \n \tTP_fast_assign(\n-\t\tmemcpy(__entry-\u003ecomm, t-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003ecomm, t, TASK_COMM_LEN);\n \t\t__entry-\u003epid = t-\u003epid;\n \t\t__entry-\u003estart = start;\n \t\t__entry-\u003eduration = duration;\ndiff --git a/include/trace/events/sched.h b/include/trace/events/sched.h\nindex 535860581f1594..afb24e9dac91e1 100644\n--- a/include/trace/events/sched.h\n+++ b/include/trace/events/sched.h\n@@ -152,7 +152,7 @@ DECLARE_EVENT_CLASS(sched_wakeup_template,\n \t),\n \n \tTP_fast_assign(\n-\t\tmemcpy(__entry-\u003ecomm, p-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003ecomm, p, TASK_COMM_LEN);\n \t\t__entry-\u003epid\t\t= p-\u003epid;\n \t\t__entry-\u003eprio\t\t= p-\u003eprio; /* XXX SCHED_DEADLINE */\n \t\t__entry-\u003etarget_cpu\t= task_cpu(p);\n@@ -237,11 +237,11 @@ TRACE_EVENT(sched_switch,\n \t),\n \n \tTP_fast_assign(\n-\t\tmemcpy(__entry-\u003eprev_comm, prev-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003eprev_comm, prev, TASK_COMM_LEN);\n \t\t__entry-\u003eprev_pid\t= prev-\u003epid;\n \t\t__entry-\u003eprev_prio\t= prev-\u003eprio;\n \t\t__entry-\u003eprev_state\t= __trace_sched_switch_state(preempt, prev_state, prev);\n-\t\tmemcpy(__entry-\u003enext_comm, next-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003enext_comm, next, TASK_COMM_LEN);\n \t\t__entry-\u003enext_pid\t= next-\u003epid;\n \t\t__entry-\u003enext_prio\t= next-\u003eprio;\n \t\t/* XXX SCHED_DEADLINE */\n@@ -346,7 +346,7 @@ TRACE_EVENT(sched_process_exit,\n \t),\n \n \tTP_fast_assign(\n-\t\tmemcpy(__entry-\u003ecomm, p-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003ecomm, p, TASK_COMM_LEN);\n \t\t__entry-\u003epid\t\t= p-\u003epid;\n \t\t__entry-\u003eprio\t\t= p-\u003eprio; /* XXX SCHED_DEADLINE */\n \t\t__entry-\u003egroup_dead\t= group_dead;\n@@ -787,7 +787,7 @@ TRACE_EVENT(sched_skip_cpuset_numa,\n \t),\n \n \tTP_fast_assign(\n-\t\tmemcpy(__entry-\u003ecomm, tsk-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003ecomm, tsk, TASK_COMM_LEN);\n \t\t__entry-\u003epid\t\t = task_pid_nr(tsk);\n \t\t__entry-\u003etgid\t\t = task_tgid_nr(tsk);\n \t\t__entry-\u003engid\t\t = task_numa_group_id(tsk);\ndiff --git a/include/trace/events/signal.h b/include/trace/events/signal.h\nindex 1db7e4b07c0148..8fffe6d9bdccf0 100644\n--- a/include/trace/events/signal.h\n+++ b/include/trace/events/signal.h\n@@ -67,7 +67,7 @@ TRACE_EVENT(signal_generate,\n \tTP_fast_assign(\n \t\t__entry-\u003esig\t= sig;\n \t\tTP_STORE_SIGINFO(__entry, info);\n-\t\tmemcpy(__entry-\u003ecomm, task-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003ecomm, task, TASK_COMM_LEN);\n \t\t__entry-\u003epid\t= task-\u003epid;\n \t\t__entry-\u003egroup\t= group;\n \t\t__entry-\u003eresult\t= result;\ndiff --git a/include/trace/events/task.h b/include/trace/events/task.h\nindex b9a129eb54d9eb..62b7df4d22d050 100644\n--- a/include/trace/events/task.h\n+++ b/include/trace/events/task.h\n@@ -21,7 +21,7 @@ TRACE_EVENT(task_newtask,\n \n \tTP_fast_assign(\n \t\t__entry-\u003epid = task-\u003epid;\n-\t\tmemcpy(__entry-\u003ecomm, task-\u003ecomm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(__entry-\u003ecomm, task, TASK_COMM_LEN);\n \t\t__entry-\u003eclone_flags = clone_flags;\n \t\t__entry-\u003eoom_score_adj = task-\u003esignal-\u003eoom_score_adj;\n \t),\n@@ -46,8 +46,9 @@ TRACE_EVENT(task_rename,\n \n \tTP_fast_assign(\n \t\t__entry-\u003epid = task-\u003epid;\n-\t\tmemcpy(entry-\u003eoldcomm, task-\u003ecomm, TASK_COMM_LEN);\n-\t\tstrscpy(entry-\u003enewcomm, comm, TASK_COMM_LEN);\n+\t\tcopy_task_comm(entry-\u003eoldcomm, task, TASK_COMM_LEN);\n+\t\tmemcpy(entry-\u003enewcomm, comm, TASK_COMM_LEN);\n+\t\tentry-\u003enewcomm[TASK_COMM_LEN - 1] = '\\0';\n \t\t__entry-\u003eoom_score_adj = task-\u003esignal-\u003eoom_score_adj;\n \t),\n \ndiff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h\nindex b6ec6f6937195f..a07f8edadd6523 100644\n--- a/include/uapi/linux/prctl.h\n+++ b/include/uapi/linux/prctl.h\n@@ -56,6 +56,9 @@\n #define PR_SET_NAME    15\t\t/* Set process name */\n #define PR_GET_NAME    16\t\t/* Get process name */\n \n+#define PR_SET_EXT_NAME    17\t\t/* Set extended process name */\n+#define PR_GET_EXT_NAME    18\t\t/* Get extended process name */\n+\n /* Get/set process endian */\n #define PR_GET_ENDIAN\t19\n #define PR_SET_ENDIAN\t20\ndiff --git a/kernel/audit.c b/kernel/audit.c\nindex 562476937fa793..1f0b44d4e5c75a 100644\n--- a/kernel/audit.c\n+++ b/kernel/audit.c\n@@ -1667,7 +1667,8 @@ static void audit_log_multicast(int group, const char *op, int err)\n \taudit_put_tty(tty);\n \taudit_log_task_context(ab); /* subj= */\n \taudit_log_format(ab, \" comm=\");\n-\taudit_log_untrustedstring(ab, get_task_comm(comm, current));\n+\tstrscpy_pad(comm, current-\u003ecomm);\n+\taudit_log_untrustedstring(ab, comm);\n \taudit_log_d_path_exe(ab, current-\u003emm); /* exe= */\n \taudit_log_format(ab, \" nl-mcgrp=%d op=%s res=%d\", group, op, !err);\n \taudit_log_end(ab);\n@@ -2476,7 +2477,8 @@ void audit_log_task_info(struct audit_buffer *ab)\n \t\t\t audit_get_sessionid(current));\n \taudit_put_tty(tty);\n \taudit_log_format(ab, \" comm=\");\n-\taudit_log_untrustedstring(ab, get_task_comm(comm, current));\n+\tstrscpy_pad(comm, current-\u003ecomm);\n+\taudit_log_untrustedstring(ab, comm);\n \taudit_log_d_path_exe(ab, current-\u003emm);\n \taudit_log_task_context(ab);\n }\ndiff --git a/kernel/auditsc.c b/kernel/auditsc.c\nindex 6610e667c728aa..1d930f169856d4 100644\n--- a/kernel/auditsc.c\n+++ b/kernel/auditsc.c\n@@ -2877,7 +2877,8 @@ void __audit_log_nfcfg(const char *name, u8 af, unsigned int nentries,\n \taudit_log_format(ab, \" pid=%u\", task_tgid_nr(current));\n \taudit_log_task_context(ab); /* subj= */\n \taudit_log_format(ab, \" comm=\");\n-\taudit_log_untrustedstring(ab, get_task_comm(comm, current));\n+\tstrscpy_pad(comm, current-\u003ecomm);\n+\taudit_log_untrustedstring(ab, comm);\n \taudit_log_end(ab);\n }\n EXPORT_SYMBOL_GPL(__audit_log_nfcfg);\n@@ -2900,7 +2901,8 @@ static void audit_log_task(struct audit_buffer *ab)\n \t\t\t sessionid);\n \taudit_log_task_context(ab);\n \taudit_log_format(ab, \" pid=%d comm=\", task_tgid_nr(current));\n-\taudit_log_untrustedstring(ab, get_task_comm(comm, current));\n+\tstrscpy_pad(comm, current-\u003ecomm);\n+\taudit_log_untrustedstring(ab, comm);\n \taudit_log_d_path_exe(ab, current-\u003emm);\n }\n \ndiff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c\nindex 4b03b019cd5ee2..f4c5ae8a3530f7 100644\n--- a/kernel/printk/nbcon.c\n+++ b/kernel/printk/nbcon.c\n@@ -952,7 +952,7 @@ static void wctxt_load_execution_ctx(struct nbcon_write_context *wctxt,\n {\n \twctxt-\u003ecpu = pmsg-\u003ecpu;\n \twctxt-\u003epid = pmsg-\u003epid;\n-\tmemcpy(wctxt-\u003ecomm, pmsg-\u003ecomm, sizeof(wctxt-\u003ecomm));\n+\tcopy_task_comm(wctxt-\u003ecomm, pmsg, sizeof(wctxt-\u003ecomm));\n \tstatic_assert(sizeof(wctxt-\u003ecomm) == sizeof(pmsg-\u003ecomm));\n }\n #else\ndiff --git a/kernel/printk/printk.c b/kernel/printk/printk.c\nindex 2fe9a963c823a4..ec0c6734bbe1cd 100644\n--- a/kernel/printk/printk.c\n+++ b/kernel/printk/printk.c\n@@ -2247,7 +2247,7 @@ static u16 printk_sprint(char *text, u16 size, int facility,\n static void printk_store_execution_ctx(struct printk_info *info)\n {\n \tinfo-\u003ecaller_id2 = printk_caller_id2();\n-\tget_task_comm(info-\u003ecomm, current);\n+\tstrscpy_pad(info-\u003ecomm, current-\u003ecomm);\n }\n \n static void pmsg_load_execution_ctx(struct printk_message *pmsg,\n@@ -2255,7 +2255,7 @@ static void pmsg_load_execution_ctx(struct printk_message *pmsg,\n {\n \tpmsg-\u003ecpu = printk_info_get_cpu(info);\n \tpmsg-\u003epid = printk_info_get_pid(info);\n-\tmemcpy(pmsg-\u003ecomm, info-\u003ecomm, sizeof(pmsg-\u003ecomm));\n+\tcopy_task_comm(pmsg-\u003ecomm, info, sizeof(pmsg-\u003ecomm));\n \tstatic_assert(sizeof(pmsg-\u003ecomm) == sizeof(info-\u003ecomm));\n }\n #else\ndiff --git a/kernel/sys.c b/kernel/sys.c\nindex df69bd71de032c..26d5026f959061 100644\n--- a/kernel/sys.c\n+++ b/kernel/sys.c\n@@ -2535,7 +2535,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,\n \t\tunsigned long, arg4, unsigned long, arg5)\n {\n \tstruct task_struct *me = current;\n-\tunsigned char comm[sizeof(me-\u003ecomm)];\n+\tunsigned char comm[TASK_COMM_EXT_LEN];\n \tlong error;\n \n \terror = security_task_prctl(option, arg2, arg3, arg4, arg5);\n@@ -2601,16 +2601,29 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,\n \t\t\terror = -EINVAL;\n \t\tbreak;\n \tcase PR_SET_NAME:\n-\t\tcomm[sizeof(me-\u003ecomm) - 1] = 0;\n+\t\tcomm[TASK_COMM_LEN - 1] = 0;\n \t\tif (strncpy_from_user(comm, (char __user *)arg2,\n-\t\t\t\t      sizeof(me-\u003ecomm) - 1) \u003c 0)\n+\t\t\t\t      TASK_COMM_LEN - 1) \u003c 0)\n \t\t\treturn -EFAULT;\n \t\tset_task_comm(me, comm);\n \t\tproc_comm_connector(me);\n \t\tbreak;\n \tcase PR_GET_NAME:\n-\t\tget_task_comm(comm, me);\n-\t\tif (copy_to_user((char __user *)arg2, comm, sizeof(comm)))\n+\t\tstrscpy_pad(comm, me-\u003ecomm, TASK_COMM_LEN);\n+\t\tif (copy_to_user((char __user *)arg2, comm, TASK_COMM_LEN))\n+\t\t\treturn -EFAULT;\n+\t\tbreak;\n+\tcase PR_SET_EXT_NAME:\n+\t\tcomm[TASK_COMM_EXT_LEN - 1] = 0;\n+\t\tif (strncpy_from_user(comm, (char __user *)arg2,\n+\t\t\t\t      TASK_COMM_EXT_LEN - 1) \u003c 0)\n+\t\t\treturn -EFAULT;\n+\t\tset_task_comm(me, comm);\n+\t\tproc_comm_connector(me);\n+\t\tbreak;\n+\tcase PR_GET_EXT_NAME:\n+\t\tstrscpy_pad(comm, me-\u003ecomm, TASK_COMM_EXT_LEN);\n+\t\tif (copy_to_user((char __user *)arg2, comm, TASK_COMM_EXT_LEN))\n \t\t\treturn -EFAULT;\n \t\tbreak;\n \tcase PR_GET_ENDIAN:\ndiff --git a/lib/tests/string_kunit.c b/lib/tests/string_kunit.c\nindex 0819ace5b02757..5d26029d2d012d 100644\n--- a/lib/tests/string_kunit.c\n+++ b/lib/tests/string_kunit.c\n@@ -881,6 +881,43 @@ static void string_bench_strrchr(struct kunit *test)\n \tSTRING_BENCH_BUF(test, buf, len, strrchr, buf, '\\0');\n }\n \n+#define TASK_NAME \"task_name\"\n+#define TASK_NAME_LEN 9\n+#define TASK_MAX_LEN TASK_COMM_EXT_LEN\n+#define SMALLER_LEN TASK_NAME_LEN - 3\n+#define BIGGER_LEN TASK_MAX_LEN + 3\n+\n+static void string_copy_task_comm(struct kunit *test)\n+{\n+\tchar str[TASK_MAX_LEN] = TASK_NAME, copy[TASK_MAX_LEN],\n+\t     smaller_buf[SMALLER_LEN], bigger_buf[BIGGER_LEN];\n+\tstatic struct task_struct task, *tsk = \u0026task;\n+\tint len1, len2, i;\n+\n+\t/* set and get task name */\n+\tset_task_comm(tsk, str);\n+\tcopy_task_comm(copy, tsk, TASK_COMM_LEN);\n+\n+\tlen1 = strlen(str);\n+\tlen2 = strlen(copy);\n+\n+\tKUNIT_ASSERT_EQ(test, len1, len2);\n+\tKUNIT_ASSERT_EQ(test, len2, TASK_NAME_LEN);\n+\tKUNIT_ASSERT_EQ(test, copy[len2], '\\0');\n+\tKUNIT_ASSERT_TRUE(test, !strcmp(str, copy));\n+\n+\t/* copy to a smaller dst buffer */\n+\tcopy_task_comm(smaller_buf, tsk, sizeof(smaller_buf));\n+\tKUNIT_ASSERT_TRUE(test, !strncmp(str, smaller_buf, SMALLER_LEN - 1));\n+\tKUNIT_ASSERT_EQ(test, smaller_buf[SMALLER_LEN - 1], '\\0');\n+\n+\t/* copy to a bigger dst buffer */\n+\tcopy_task_comm(bigger_buf, tsk, sizeof(bigger_buf));\n+\tKUNIT_ASSERT_TRUE(test, !strncmp(str, bigger_buf, TASK_NAME_LEN));\n+\tfor (i = TASK_NAME_LEN; i \u003c BIGGER_LEN; i++)\n+\t\tKUNIT_ASSERT_EQ(test, bigger_buf[i], '\\0');\n+}\n+\n static struct kunit_case string_test_cases[] = {\n \tKUNIT_CASE(string_test_memset16),\n \tKUNIT_CASE(string_test_memset32),\n@@ -910,6 +947,7 @@ static struct kunit_case string_test_cases[] = {\n \tKUNIT_CASE(string_bench_strnlen),\n \tKUNIT_CASE(string_bench_strchr),\n \tKUNIT_CASE(string_bench_strrchr),\n+\tKUNIT_CASE(string_copy_task_comm),\n \t{}\n };\n \ndiff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c\nindex 070ca388f9ace8..4e66cb2d9549c6 100644\n--- a/net/bluetooth/hci_sock.c\n+++ b/net/bluetooth/hci_sock.c\n@@ -104,7 +104,7 @@ static bool hci_sock_gen_cookie(struct sock *sk)\n \t\t\tid = 0xffffffff;\n \n \t\thci_pi(sk)-\u003ecookie = id;\n-\t\tget_task_comm(hci_pi(sk)-\u003ecomm, current);\n+\t\tstrscpy_pad(hci_pi(sk)-\u003ecomm, current-\u003ecomm);\n \t\treturn true;\n \t}\n \ndiff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c\nindex a9eaf9455c7783..c5555eed1b62d2 100644\n--- a/net/netfilter/nf_tables_api.c\n+++ b/net/netfilter/nf_tables_api.c\n@@ -9718,9 +9718,11 @@ static int nf_tables_fill_gen_info(struct sk_buff *skb, struct net *net,\n \tif (!nlh)\n \t\tgoto nla_put_failure;\n \n+\tstrscpy_pad(buf, current-\u003ecomm);\n+\n \tif (nla_put_be32(skb, NFTA_GEN_ID, htonl(nft_base_seq(net))) ||\n \t    nla_put_be32(skb, NFTA_GEN_PROC_PID, htonl(task_pid_nr(current))) ||\n-\t    nla_put_string(skb, NFTA_GEN_PROC_NAME, get_task_comm(buf, current)))\n+\t    nla_put_string(skb, NFTA_GEN_PROC_NAME, buf))\n \t\tgoto nla_put_failure;\n \n \tnlmsg_end(skb, nlh);\ndiff --git a/security/integrity/integrity_audit.c b/security/integrity/integrity_audit.c\nindex d8d9e5ff1cd22b..98060060929da9 100644\n--- a/security/integrity/integrity_audit.c\n+++ b/security/integrity/integrity_audit.c\n@@ -54,7 +54,8 @@ void integrity_audit_message(int audit_msgno, struct inode *inode,\n \t\t\t audit_get_sessionid(current));\n \taudit_log_task_context(ab);\n \taudit_log_format(ab, \" op=%s cause=%s comm=\", op, cause);\n-\taudit_log_untrustedstring(ab, get_task_comm(name, current));\n+\tstrscpy_pad(name, current-\u003ecomm);\n+\taudit_log_untrustedstring(ab, name);\n \tif (fname) {\n \t\taudit_log_format(ab, \" name=\");\n \t\taudit_log_untrustedstring(ab, fname);\ndiff --git a/security/ipe/audit.c b/security/ipe/audit.c\nindex 93fb59fbddd60b..90a6acfb7cdfcf 100644\n--- a/security/ipe/audit.c\n+++ b/security/ipe/audit.c\n@@ -145,7 +145,8 @@ void ipe_audit_match(const struct ipe_eval_ctx *const ctx,\n \taudit_log_format(ab, \"ipe_op=%s ipe_hook=%s enforcing=%d pid=%d comm=\",\n \t\t\t op, audit_hook_names[ctx-\u003ehook], READ_ONCE(enforce),\n \t\t\t task_tgid_nr(current));\n-\taudit_log_untrustedstring(ab, get_task_comm(comm, current));\n+\tstrscpy_pad(comm, current-\u003ecomm);\n+\taudit_log_untrustedstring(ab, comm);\n \n \tif (ctx-\u003efile) {\n \t\taudit_log_d_path(ab, \" path=\", \u0026ctx-\u003efile-\u003ef_path);\ndiff --git a/security/landlock/domain.c b/security/landlock/domain.c\nindex 9a8355fccd26eb..b2fc7f722d6908 100644\n--- a/security/landlock/domain.c\n+++ b/security/landlock/domain.c\n@@ -102,7 +102,7 @@ static struct landlock_details *get_current_details(void)\n \tmemcpy(details-\u003eexe_path, path_str, path_size);\n \tdetails-\u003epid = get_pid(task_tgid(current));\n \tdetails-\u003euid = from_kuid(\u0026init_user_ns, current_uid());\n-\tget_task_comm(details-\u003ecomm, current);\n+\tstrscpy_pad(details-\u003ecomm, current-\u003ecomm);\n \treturn details;\n }\n \ndiff --git a/security/lsm_audit.c b/security/lsm_audit.c\nindex 737f5a263a8f79..a587ffecd9852c 100644\n--- a/security/lsm_audit.c\n+++ b/security/lsm_audit.c\n@@ -276,8 +276,8 @@ void audit_log_lsm_data(struct audit_buffer *ab,\n \t\t\tif (pid) {\n \t\t\t\tchar tskcomm[sizeof(tsk-\u003ecomm)];\n \t\t\t\taudit_log_format(ab, \" opid=%d ocomm=\", pid);\n-\t\t\t\taudit_log_untrustedstring(ab,\n-\t\t\t\t    get_task_comm(tskcomm, tsk));\n+\t\t\t\tstrscpy_pad(tskcomm, tsk-\u003ecomm);\n+\t\t\t\taudit_log_untrustedstring(ab, tskcomm);\n \t\t\t}\n \t\t}\n \t\tbreak;\n@@ -417,7 +417,8 @@ static void dump_common_audit_data(struct audit_buffer *ab,\n \tchar comm[sizeof(current-\u003ecomm)];\n \n \taudit_log_format(ab, \" pid=%d comm=\", task_tgid_nr(current));\n-\taudit_log_untrustedstring(ab, get_task_comm(comm, current));\n+\tstrscpy_pad(comm, current-\u003ecomm);\n+\taudit_log_untrustedstring(ab, comm);\n \taudit_log_lsm_data(ab, a);\n }\n \ndiff --git a/tools/testing/selftests/prctl/set-process-name.c b/tools/testing/selftests/prctl/set-process-name.c\nindex 3f7b146d36dfe1..0f20f7deac67fd 100644\n--- a/tools/testing/selftests/prctl/set-process-name.c\n+++ b/tools/testing/selftests/prctl/set-process-name.c\n@@ -9,9 +9,17 @@\n \n #include \"kselftest_harness.h\"\n \n+#ifndef PR_SET_EXT_NAME\n+# define PR_SET_EXT_NAME 17\n+# define PR_GET_EXT_NAME 18\n+#endif\n+\n #define CHANGE_NAME \"changename\"\n+#define LONG_NAME\t\"change_to_very_long_extended_name\"\n+#define LONG_NAME_CAP\t\"change_to_very_\"\n #define EMPTY_NAME \"\"\n #define TASK_COMM_LEN 16\n+#define TASK_COMM_EXT_LEN 64\n #define MAX_PATH_LEN 50\n \n int set_name(char *name)\n@@ -25,6 +33,16 @@ int set_name(char *name)\n \treturn res;\n }\n \n+int set_ext_name(char *name)\n+{\n+\tint res;\n+\n+\tres = prctl(PR_SET_EXT_NAME, name, NULL, NULL, NULL);\n+\n+\tif (res \u003c 0)\n+\t\treturn -errno;\n+}\n+\n int check_is_name_correct(char *check_name)\n {\n \tchar name[TASK_COMM_LEN];\n@@ -38,6 +56,19 @@ int check_is_name_correct(char *check_name)\n \treturn !strcmp(name, check_name);\n }\n \n+int check_is_ext_name_correct(char *check_name)\n+{\n+\tchar name[TASK_COMM_EXT_LEN];\n+\tint res;\n+\n+\tres = prctl(PR_GET_EXT_NAME, name, NULL, NULL, NULL);\n+\n+\tif (res \u003c 0)\n+\t\treturn -errno;\n+\n+\treturn !strcmp(name, check_name);\n+}\n+\n int check_null_pointer(char *check_name)\n {\n \tchar *name = NULL;\n@@ -82,6 +113,11 @@ TEST(rename_process) {\n \tEXPECT_GE(set_name(CHANGE_NAME), 0);\n \tEXPECT_TRUE(check_is_name_correct(CHANGE_NAME));\n \n+\tEXPECT_GE(set_ext_name(LONG_NAME), 0);\n+\tEXPECT_TRUE(check_is_ext_name_correct(LONG_NAME));\n+\tEXPECT_TRUE(check_is_name_correct(LONG_NAME_CAP));\n+\tEXPECT_TRUE(check_name());\n+\n \tEXPECT_GE(set_name(EMPTY_NAME), 0);\n \tEXPECT_TRUE(check_is_name_correct(EMPTY_NAME));\n \n"
}

2/1 2026/07/17 20:53 agent patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [
    "sys_prctl"
  ],
  "Reasoning": "The patch adds new prctl options PR_SET_EXT_NAME and PR_GET_EXT_NAME to set and get extended process names, which is a functional change reachable from userspace and should be fuzzed.",
  "WorthFuzzing": true
}

Instruction:
You are an expert Linux kernel maintainer.
Your job is to review a provided patch series and determine
if it makes functional changes to the kernel that should be fuzzed.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively
use your code access tools to examine the actual source code and confirm any assumptions.

Return WorthFuzzing=false if the patch only contains:
- Modifications to Documentation/, Kconfig files, or code comments.
- Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints.
- Changes to numeric constants or macros that do not functionally alter execution flow.
- Code paths that are impossible to reach in virtualized environments like GCE or QEMU,
even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim).

If it modifies reachable core kernel logic, drivers, or architectures, use your code search
tools to verify the code can be executed, then return WorthFuzzing=true.

When returning WorthFuzzing=true, you MUST ALSO:
1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols.
   Avoid listing generic hot-path functions to prevent skewed test distributions.
2. Identify any specific CONFIG_ options required to properly test this new/modified feature.
   Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions.
   Do not list too generic configs (we already have them enabled). Only list those that
   specifically cover the modified code. List them in the EnableConfigs output array,
   and DO NOT add a 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
For your convenience, here is the diff of the changes:
commit 6de54c3decb3c13f294ea911e9c8cedccf2efd29
Author: syz-cluster <triage@syzkaller.com>
Date:   Fri Jul 17 20:53:23 2026 +0000

    syz-cluster: applied patch under review

diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index 0056ab81fbc39a..c78243ed3c2a96 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 8df20b0218a9ee..d501657ad80129 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 6a364357522b8a..13c8857e4ffba1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
@@ -74,7 +74,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->svm_bo = svm_bo;
 	fence->context_id = context_id;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
index f6b7522c3c82ff..046243e3a3cd03 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 764cd49504083c..e60a470b57ecc1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -4445,7 +4445,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 f74ad378e40742..f41857473641bc 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 bb99b7c3a010ea..84c0b310e9c147 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2542,10 +2542,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 2a241a5b12c420..f8ce59d8587a1f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -563,7 +563,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 68ede7a725e219..e8c5c3601bf1d5 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 3a7fce4288987b..11936c4d35736b 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 a1e2eb1ca7bbe6..ebb3664e4303cc 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 298b046c95edb8..81c4659c0d7be9 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 3d8e4ccdb7c1f8..b10a0e1cb1ed70 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 f48c6a8a0654e9..c7715439964e81 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 d014af6ab060e5..d514a81d0a5c8e 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 16a56b6b3f6ca1..d25922460b6378 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1557,7 +1557,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 7e3108489c83ca..c4d4e59ff34d1b 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -1371,7 +1371,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 479ea8cb4ef43d..0490b9ef278850 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, TASK_COMM_LEN);
 
 	if (escape)
 		seq_escape_str(m, tcomm, ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\");
diff --git a/include/linux/coredump.h b/include/linux/coredump.h
index 7b38ee2e7913be..dee82e3c350af5 100644
--- a/include/linux/coredump.h
+++ b/include/linux/coredump.h
@@ -58,7 +58,7 @@ extern void vfs_coredump(const kernel_siginfo_t *siginfo);
 	do {	\
 		char comm[TASK_COMM_LEN];	\
 		/* This will always be NUL terminated. */ \
-		memcpy(comm, current->comm, sizeof(comm)); \
+		copy_task_comm(comm, current, sizeof(comm)); \
 		printk_ratelimited(Level "coredump: %d(%*pE): " Format "\n",	\
 			task_tgid_vnr(current), (int)strlen(comm), comm, ##__VA_ARGS__);	\
 	} while (0)	\
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 373bcc0598d10b..0f1b40a5dbc60b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -323,6 +323,7 @@ struct user_event_mm;
  */
 enum {
 	TASK_COMM_LEN = 16,
+	TASK_COMM_EXT_LEN = 64,
 };
 
 extern void sched_tick(void);
@@ -1178,7 +1179,7 @@ struct task_struct {
 	 * - set it with set_task_comm() to ensure it is always
 	 *   NUL-terminated and zero-padded
 	 */
-	char				comm[TASK_COMM_LEN];
+	char				comm[TASK_COMM_EXT_LEN];
 
 	struct nameidata		*nameidata;
 
@@ -2017,28 +2018,20 @@ extern void kick_process(struct task_struct *tsk);
 
 extern void __set_task_comm(struct task_struct *tsk, const char *from, bool exec);
 #define set_task_comm(tsk, from) ({			\
-	BUILD_BUG_ON(sizeof(from) != TASK_COMM_LEN);	\
+	BUILD_BUG_ON(sizeof(from) < TASK_COMM_LEN);	\
 	__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.
+ * Copy task name to a buffer. Final result is always a NUL-terminated string.
  */
-#define get_task_comm(buf, tsk) ({			\
-	BUILD_BUG_ON(sizeof(buf) < TASK_COMM_LEN);	\
-	strscpy_pad(buf, (tsk)->comm);			\
-	buf;						\
-})
+static __always_inline void copy_task_comm(char *dst, struct task_struct *tsk, size_t len)
+{
+	const char *_src = tsk->comm;
+
+	memcpy(dst, _src, len);
+	dst[len - 1] = '\0';
+}
 
 static __always_inline void scheduler_ipi(void)
 {
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index e0d838c9ce9382..9b0094fa44c649 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -637,10 +637,10 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
  *	*
  *
  *	TP_fast_assign(
- *		memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
+ *		copy_task_comm(__entry->next_comm, next, TASK_COMM_LEN);
  *		__entry->prev_pid	= prev->pid;
  *		__entry->prev_prio	= prev->prio;
- *		memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
+ *		copy_task_comm(__entry->prev_comm, prev, TASK_COMM_LEN);
  *		__entry->next_pid	= next->pid;
  *		__entry->next_prio	= next->prio;
  *	),
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 9c97a16850b922..1e3a9ded03bd4f 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -213,7 +213,7 @@ DECLARE_EVENT_CLASS(block_rq,
 
 		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
 		__get_str(cmd)[0] = '\0';
-		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, current, TASK_COMM_LEN);
 	),
 
 	TP_printk("%d,%d %s %u (%s) %llu + %u %s,%u,%u [%s]",
@@ -410,7 +410,7 @@ DECLARE_EVENT_CLASS(block_bio,
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->nr_sector	= bio_sectors(bio);
 		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
-		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, current, TASK_COMM_LEN);
 	),
 
 	TP_printk("%d,%d %s %llu + %u [%s]",
@@ -493,7 +493,7 @@ TRACE_EVENT(block_plug,
 	),
 
 	TP_fast_assign(
-		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, current, TASK_COMM_LEN);
 	),
 
 	TP_printk("[%s]", __entry->comm)
@@ -512,7 +512,7 @@ DECLARE_EVENT_CLASS(block_unplug,
 
 	TP_fast_assign(
 		__entry->nr_rq = depth;
-		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, current, TASK_COMM_LEN);
 	),
 
 	TP_printk("[%s] %d", __entry->comm, __entry->nr_rq)
@@ -563,7 +563,7 @@ TRACE_EVENT(block_split,
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->new_sector	= new_sector;
 		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
-		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, current, TASK_COMM_LEN);
 	),
 
 	TP_printk("%d,%d %s %llu / %llu [%s]",
diff --git a/include/trace/events/coredump.h b/include/trace/events/coredump.h
index c7b9c53fc49869..fdd20bc46bb027 100644
--- a/include/trace/events/coredump.h
+++ b/include/trace/events/coredump.h
@@ -32,7 +32,7 @@ TRACE_EVENT(coredump,
 
 	TP_fast_assign(
 		__entry->sig = sig;
-		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, current, TASK_COMM_LEN);
 	),
 
 	TP_printk("sig=%d comm=%s",
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index 270c1a2c24c44a..7d22650b4c785f 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -2505,7 +2505,7 @@ TRACE_EVENT(f2fs_lock_elapsed_time,
 
 	TP_fast_assign(
 		__entry->dev		= sbi->sb->s_dev;
-		memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, p, TASK_COMM_LEN);
 		__entry->pid		= p->pid;
 		__entry->prio		= p->prio;
 		__entry->ioprio_class	= IOPRIO_PRIO_CLASS(ioprio);
@@ -2558,7 +2558,7 @@ DECLARE_EVENT_CLASS(f2fs_priority_update,
 
 	TP_fast_assign(
 		__entry->dev		= sbi->sb->s_dev;
-		memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, p, TASK_COMM_LEN);
 		__entry->pid		= p->pid;
 		__entry->lock_name	= lock_name;
 		__entry->is_write	= is_write;
diff --git a/include/trace/events/oom.h b/include/trace/events/oom.h
index 9f0a5d1482c448..8bcdc4ffc8d344 100644
--- a/include/trace/events/oom.h
+++ b/include/trace/events/oom.h
@@ -23,7 +23,7 @@ TRACE_EVENT(oom_score_adj_update,
 
 	TP_fast_assign(
 		__entry->pid = task->pid;
-		memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, task, TASK_COMM_LEN);
 		__entry->oom_score_adj = task->signal->oom_score_adj;
 	),
 
diff --git a/include/trace/events/osnoise.h b/include/trace/events/osnoise.h
index 3f42736238014e..2cf047bb9fb71d 100644
--- a/include/trace/events/osnoise.h
+++ b/include/trace/events/osnoise.h
@@ -116,7 +116,7 @@ TRACE_EVENT(thread_noise,
 	),
 
 	TP_fast_assign(
-		memcpy(__entry->comm, t->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, t, TASK_COMM_LEN);
 		__entry->pid = t->pid;
 		__entry->start = start;
 		__entry->duration = duration;
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 535860581f1594..afb24e9dac91e1 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -152,7 +152,7 @@ DECLARE_EVENT_CLASS(sched_wakeup_template,
 	),
 
 	TP_fast_assign(
-		memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, p, TASK_COMM_LEN);
 		__entry->pid		= p->pid;
 		__entry->prio		= p->prio; /* XXX SCHED_DEADLINE */
 		__entry->target_cpu	= task_cpu(p);
@@ -237,11 +237,11 @@ TRACE_EVENT(sched_switch,
 	),
 
 	TP_fast_assign(
-		memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->prev_comm, prev, TASK_COMM_LEN);
 		__entry->prev_pid	= prev->pid;
 		__entry->prev_prio	= prev->prio;
 		__entry->prev_state	= __trace_sched_switch_state(preempt, prev_state, prev);
-		memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->next_comm, next, TASK_COMM_LEN);
 		__entry->next_pid	= next->pid;
 		__entry->next_prio	= next->prio;
 		/* XXX SCHED_DEADLINE */
@@ -346,7 +346,7 @@ TRACE_EVENT(sched_process_exit,
 	),
 
 	TP_fast_assign(
-		memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, p, TASK_COMM_LEN);
 		__entry->pid		= p->pid;
 		__entry->prio		= p->prio; /* XXX SCHED_DEADLINE */
 		__entry->group_dead	= group_dead;
@@ -787,7 +787,7 @@ TRACE_EVENT(sched_skip_cpuset_numa,
 	),
 
 	TP_fast_assign(
-		memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, tsk, TASK_COMM_LEN);
 		__entry->pid		 = task_pid_nr(tsk);
 		__entry->tgid		 = task_tgid_nr(tsk);
 		__entry->ngid		 = task_numa_group_id(tsk);
diff --git a/include/trace/events/signal.h b/include/trace/events/signal.h
index 1db7e4b07c0148..8fffe6d9bdccf0 100644
--- a/include/trace/events/signal.h
+++ b/include/trace/events/signal.h
@@ -67,7 +67,7 @@ TRACE_EVENT(signal_generate,
 	TP_fast_assign(
 		__entry->sig	= sig;
 		TP_STORE_SIGINFO(__entry, info);
-		memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, task, TASK_COMM_LEN);
 		__entry->pid	= task->pid;
 		__entry->group	= group;
 		__entry->result	= result;
diff --git a/include/trace/events/task.h b/include/trace/events/task.h
index b9a129eb54d9eb..62b7df4d22d050 100644
--- a/include/trace/events/task.h
+++ b/include/trace/events/task.h
@@ -21,7 +21,7 @@ TRACE_EVENT(task_newtask,
 
 	TP_fast_assign(
 		__entry->pid = task->pid;
-		memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, task, TASK_COMM_LEN);
 		__entry->clone_flags = clone_flags;
 		__entry->oom_score_adj = task->signal->oom_score_adj;
 	),
@@ -46,8 +46,9 @@ TRACE_EVENT(task_rename,
 
 	TP_fast_assign(
 		__entry->pid = task->pid;
-		memcpy(entry->oldcomm, task->comm, TASK_COMM_LEN);
-		strscpy(entry->newcomm, comm, TASK_COMM_LEN);
+		copy_task_comm(entry->oldcomm, task, TASK_COMM_LEN);
+		memcpy(entry->newcomm, comm, TASK_COMM_LEN);
+		entry->newcomm[TASK_COMM_LEN - 1] = '\0';
 		__entry->oom_score_adj = task->signal->oom_score_adj;
 	),
 
diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h
index b6ec6f6937195f..a07f8edadd6523 100644
--- a/include/uapi/linux/prctl.h
+++ b/include/uapi/linux/prctl.h
@@ -56,6 +56,9 @@
 #define PR_SET_NAME    15		/* Set process name */
 #define PR_GET_NAME    16		/* Get process name */
 
+#define PR_SET_EXT_NAME    17		/* Set extended process name */
+#define PR_GET_EXT_NAME    18		/* Get extended process name */
+
 /* Get/set process endian */
 #define PR_GET_ENDIAN	19
 #define PR_SET_ENDIAN	20
diff --git a/kernel/audit.c b/kernel/audit.c
index 562476937fa793..1f0b44d4e5c75a 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);
@@ -2476,7 +2477,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 6610e667c728aa..1d930f169856d4 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -2877,7 +2877,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);
@@ -2900,7 +2901,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/nbcon.c b/kernel/printk/nbcon.c
index 4b03b019cd5ee2..f4c5ae8a3530f7 100644
--- a/kernel/printk/nbcon.c
+++ b/kernel/printk/nbcon.c
@@ -952,7 +952,7 @@ static void wctxt_load_execution_ctx(struct nbcon_write_context *wctxt,
 {
 	wctxt->cpu = pmsg->cpu;
 	wctxt->pid = pmsg->pid;
-	memcpy(wctxt->comm, pmsg->comm, sizeof(wctxt->comm));
+	copy_task_comm(wctxt->comm, pmsg, sizeof(wctxt->comm));
 	static_assert(sizeof(wctxt->comm) == sizeof(pmsg->comm));
 }
 #else
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 2fe9a963c823a4..ec0c6734bbe1cd 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,
@@ -2255,7 +2255,7 @@ static void pmsg_load_execution_ctx(struct printk_message *pmsg,
 {
 	pmsg->cpu = printk_info_get_cpu(info);
 	pmsg->pid = printk_info_get_pid(info);
-	memcpy(pmsg->comm, info->comm, sizeof(pmsg->comm));
+	copy_task_comm(pmsg->comm, info, sizeof(pmsg->comm));
 	static_assert(sizeof(pmsg->comm) == sizeof(info->comm));
 }
 #else
diff --git a/kernel/sys.c b/kernel/sys.c
index df69bd71de032c..26d5026f959061 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2535,7 +2535,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
 		unsigned long, arg4, unsigned long, arg5)
 {
 	struct task_struct *me = current;
-	unsigned char comm[sizeof(me->comm)];
+	unsigned char comm[TASK_COMM_EXT_LEN];
 	long error;
 
 	error = security_task_prctl(option, arg2, arg3, arg4, arg5);
@@ -2601,16 +2601,29 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
 			error = -EINVAL;
 		break;
 	case PR_SET_NAME:
-		comm[sizeof(me->comm) - 1] = 0;
+		comm[TASK_COMM_LEN - 1] = 0;
 		if (strncpy_from_user(comm, (char __user *)arg2,
-				      sizeof(me->comm) - 1) < 0)
+				      TASK_COMM_LEN - 1) < 0)
 			return -EFAULT;
 		set_task_comm(me, comm);
 		proc_comm_connector(me);
 		break;
 	case PR_GET_NAME:
-		get_task_comm(comm, me);
-		if (copy_to_user((char __user *)arg2, comm, sizeof(comm)))
+		strscpy_pad(comm, me->comm, TASK_COMM_LEN);
+		if (copy_to_user((char __user *)arg2, comm, TASK_COMM_LEN))
+			return -EFAULT;
+		break;
+	case PR_SET_EXT_NAME:
+		comm[TASK_COMM_EXT_LEN - 1] = 0;
+		if (strncpy_from_user(comm, (char __user *)arg2,
+				      TASK_COMM_EXT_LEN - 1) < 0)
+			return -EFAULT;
+		set_task_comm(me, comm);
+		proc_comm_connector(me);
+		break;
+	case PR_GET_EXT_NAME:
+		strscpy_pad(comm, me->comm, TASK_COMM_EXT_LEN);
+		if (copy_to_user((char __user *)arg2, comm, TASK_COMM_EXT_LEN))
 			return -EFAULT;
 		break;
 	case PR_GET_ENDIAN:
diff --git a/lib/tests/string_kunit.c b/lib/tests/string_kunit.c
index 0819ace5b02757..5d26029d2d012d 100644
--- a/lib/tests/string_kunit.c
+++ b/lib/tests/string_kunit.c
@@ -881,6 +881,43 @@ static void string_bench_strrchr(struct kunit *test)
 	STRING_BENCH_BUF(test, buf, len, strrchr, buf, '\0');
 }
 
+#define TASK_NAME "task_name"
+#define TASK_NAME_LEN 9
+#define TASK_MAX_LEN TASK_COMM_EXT_LEN
+#define SMALLER_LEN TASK_NAME_LEN - 3
+#define BIGGER_LEN TASK_MAX_LEN + 3
+
+static void string_copy_task_comm(struct kunit *test)
+{
+	char str[TASK_MAX_LEN] = TASK_NAME, copy[TASK_MAX_LEN],
+	     smaller_buf[SMALLER_LEN], bigger_buf[BIGGER_LEN];
+	static struct task_struct task, *tsk = &task;
+	int len1, len2, i;
+
+	/* set and get task name */
+	set_task_comm(tsk, str);
+	copy_task_comm(copy, tsk, TASK_COMM_LEN);
+
+	len1 = strlen(str);
+	len2 = strlen(copy);
+
+	KUNIT_ASSERT_EQ(test, len1, len2);
+	KUNIT_ASSERT_EQ(test, len2, TASK_NAME_LEN);
+	KUNIT_ASSERT_EQ(test, copy[len2], '\0');
+	KUNIT_ASSERT_TRUE(test, !strcmp(str, copy));
+
+	/* copy to a smaller dst buffer */
+	copy_task_comm(smaller_buf, tsk, sizeof(smaller_buf));
+	KUNIT_ASSERT_TRUE(test, !strncmp(str, smaller_buf, SMALLER_LEN - 1));
+	KUNIT_ASSERT_EQ(test, smaller_buf[SMALLER_LEN - 1], '\0');
+
+	/* copy to a bigger dst buffer */
+	copy_task_comm(bigger_buf, tsk, sizeof(bigger_buf));
+	KUNIT_ASSERT_TRUE(test, !strncmp(str, bigger_buf, TASK_NAME_LEN));
+	for (i = TASK_NAME_LEN; i < BIGGER_LEN; i++)
+		KUNIT_ASSERT_EQ(test, bigger_buf[i], '\0');
+}
+
 static struct kunit_case string_test_cases[] = {
 	KUNIT_CASE(string_test_memset16),
 	KUNIT_CASE(string_test_memset32),
@@ -910,6 +947,7 @@ static struct kunit_case string_test_cases[] = {
 	KUNIT_CASE(string_bench_strnlen),
 	KUNIT_CASE(string_bench_strchr),
 	KUNIT_CASE(string_bench_strrchr),
+	KUNIT_CASE(string_copy_task_comm),
 	{}
 };
 
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 070ca388f9ace8..4e66cb2d9549c6 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 a9eaf9455c7783..c5555eed1b62d2 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -9718,9 +9718,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 d8d9e5ff1cd22b..98060060929da9 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 93fb59fbddd60b..90a6acfb7cdfcf 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 9a8355fccd26eb..b2fc7f722d6908 100644
--- a/security/landlock/domain.c
+++ b/security/landlock/domain.c
@@ -102,7 +102,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 737f5a263a8f79..a587ffecd9852c 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);
 }
 
diff --git a/tools/testing/selftests/prctl/set-process-name.c b/tools/testing/selftests/prctl/set-process-name.c
index 3f7b146d36dfe1..0f20f7deac67fd 100644
--- a/tools/testing/selftests/prctl/set-process-name.c
+++ b/tools/testing/selftests/prctl/set-process-name.c
@@ -9,9 +9,17 @@
 
 #include "kselftest_harness.h"
 
+#ifndef PR_SET_EXT_NAME
+# define PR_SET_EXT_NAME 17
+# define PR_GET_EXT_NAME 18
+#endif
+
 #define CHANGE_NAME "changename"
+#define LONG_NAME	"change_to_very_long_extended_name"
+#define LONG_NAME_CAP	"change_to_very_"
 #define EMPTY_NAME ""
 #define TASK_COMM_LEN 16
+#define TASK_COMM_EXT_LEN 64
 #define MAX_PATH_LEN 50
 
 int set_name(char *name)
@@ -25,6 +33,16 @@ int set_name(char *name)
 	return res;
 }
 
+int set_ext_name(char *name)
+{
+	int res;
+
+	res = prctl(PR_SET_EXT_NAME, name, NULL, NULL, NULL);
+
+	if (res < 0)
+		return -errno;
+}
+
 int check_is_name_correct(char *check_name)
 {
 	char name[TASK_COMM_LEN];
@@ -38,6 +56,19 @@ int check_is_name_correct(char *check_name)
 	return !strcmp(name, check_name);
 }
 
+int check_is_ext_name_correct(char *check_name)
+{
+	char name[TASK_COMM_EXT_LEN];
+	int res;
+
+	res = prctl(PR_GET_EXT_NAME, name, NULL, NULL, NULL);
+
+	if (res < 0)
+		return -errno;
+
+	return !strcmp(name, check_name);
+}
+
 int check_null_pointer(char *check_name)
 {
 	char *name = NULL;
@@ -82,6 +113,11 @@ TEST(rename_process) {
 	EXPECT_GE(set_name(CHANGE_NAME), 0);
 	EXPECT_TRUE(check_is_name_correct(CHANGE_NAME));
 
+	EXPECT_GE(set_ext_name(LONG_NAME), 0);
+	EXPECT_TRUE(check_is_ext_name_correct(LONG_NAME));
+	EXPECT_TRUE(check_is_name_correct(LONG_NAME_CAP));
+	EXPECT_TRUE(check_name());
+
 	EXPECT_GE(set_name(EMPTY_NAME), 0);
 	EXPECT_TRUE(check_is_name_correct(EMPTY_NAME));
 

3/2 2026/07/17 20:53 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 16286
							output: 83
							thoughts: 1031
						

Thoughts:
**Analysis of the Extended Task Comm Patch**

Okay, so we've got a patch here that's expanding the `task_comm` length and adding new `prctl` options. Let's break this down. My initial thought is that this has the potential for some interesting fuzzing targets, especially since we're dealing with `prctl`, a syscall exposed to userspace.

The core of the patch revolves around two main areas: extending the `comm` buffer in `struct task_struct` and adding `PR_SET_EXT_NAME` and `PR_GET_EXT_NAME` to `prctl`.  The change to the `comm` length from `TASK_COMM_LEN` (16) to `TASK_COMM_EXT_LEN` (64) is substantial, affecting how process names are handled throughout the kernel, but the new prctl options are the focus.

Looking at the code added to `kernel/sys.c`, the new `prctl` options are straightforward: `PR_SET_EXT_NAME` copies a user-provided string to `me->comm` via `strncpy_from_user` and `set_task_comm` after null-terminating the string, while `PR_GET_EXT_NAME` copies the extended name back to userspace using `copy_to_user`.  Critically, `proc_comm_connector` is called after setting the name; this might be interesting depending on how it's used. We need to remember that `proc_comm_connector`'s availability depends on `CONFIG_PROC_EVENTS`, but this doesn't directly affect `prctl` itself.

The `prctl` syscall is our main entry point here; specifically, `sys_prctl` (or the architecture-specific version of it, but Syzkaller knows about `prctl`).  I double-checked `kernel/sys.c` to confirm this. While `set_task_comm` isn't directly modified, it calls `__set_task_comm`, which in turn calls `copy_task_comm`.  But the new inline function `copy_task_comm` is introduced by the patch, along with the main logic in `sys_prctl`. So `sys_prctl` will be our primary focus.

Since this patch *adds* new functionality (setting and getting extended process names), it's definitely something we should prioritize for fuzzing. The new `prctl` options introduce a new code path that's directly reachable from userspace, which is a classic fuzzing target.

In terms of configuration, `prctl` itself doesn't require any specific kernel configs, so that simplifies things.

Finally, we're definitely going to label this as `WorthFuzzing: true`.  The `FocusSymbols` will be `sys_prctl`. `EnableConfigs` will be an empty array as there are no specific configs needed. The reasoning is simple: this is a functional change that introduces new `prctl` options, directly affecting userspace interaction with the kernel.



4/2 2026/07/17 20:53 tool set-results
0m Args:
{
  "EnableConfigs": [],
  "FocusSymbols": [
    "sys_prctl"
  ],
  "Reasoning": "The patch adds new prctl options PR_SET_EXT_NAME and PR_GET_EXT_NAME to set and get extended process names, which is a functional change reachable from userspace and should be fuzzed.",
  "WorthFuzzing": true
}

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [
    "sys_prctl"
  ],
  "Reasoning": "The patch adds new prctl options PR_SET_EXT_NAME and PR_GET_EXT_NAME to set and get extended process names, which is a functional change reachable from userspace and should be fuzzed.",
  "WorthFuzzing": true
}

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)