Skip to contentSkip to conversation

fs-exec-replace-strlcpy-with-strscpy_pad-in-__set_task_comm.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jan 20, 2022

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: fs/exec: replace strlcpy with strscpy_pad in __set_task_comm
has been removed from the -mm tree. Its filename was
fs-exec-replace-strlcpy-with-strscpy_pad-in-__set_task_comm.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Yafang Shao <[email protected]>
Subject: fs/exec: replace strlcpy with strscpy_pad in __set_task_comm

Patch series "task comm cleanups", v2.

This patchset is part of the patchset "extend task comm from 16 to 24"[1]. Now we have different opinion that dynamically allocates memory to store kthread's long name into a separate pointer, so I decide to take the useful cleanups apart from the original patchset and send it separately[2].

These useful cleanups can make the usage around task comm less error-prone. Furthermore, it will be useful if we want to extend task comm in the future.

[1]. https://lore.kernel.org/lkml/[email protected]/
[2]. https://lore.kernel.org/lkml/CALOAHbAx55AUo3bm8ZepZSZnw7A08cvKPdPyNTf=E_tPqmw5hw@mail.gmail.com/

This patch (of 7):

strlcpy() can trigger out-of-bound reads on the source string[1], we'd better use strscpy() instead. To make it be robust against full tsk->comm copies that got noticed in other places, we should make sure it's zero padded.

[1] https://github.com/KSPP/linux/issues/89

Cc Mathieu Desnoyers <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Alexei Starovoitov <[email protected]>
Cc Andrii Nakryiko <[email protected]>
Cc Michal Miroslaw <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Al Viro <[email protected]>
Cc Kees Cook <[email protected]>
Cc Petr Mladek <[email protected]>
Cc Andrii Nakryiko <[email protected]>
Cc Dennis Dalessandro <[email protected]>

---

 fs/exec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/exec.c renamed from fs/exec.c~fs-exec-replace-strlcpy-with-strscpy_pad-in-__set_task_comm +1 -1
@@ -1222,7 +1222,7 @@ void __set_task_comm(struct task_struct
 {
 	task_lock(tsk);
 	trace_task_rename(tsk, buf);
-	strlcpy(tsk->comm, buf, sizeof(tsk->comm));
+	strscpy_pad(tsk->comm, buf, sizeof(tsk->comm));
 	task_unlock(tsk);
 	perf_event_comm(tsk, exec);
 }

_

Patches currently in -mm which might be from [email protected] are