Skip to content

Commit 613b48b

Browse files
committed
Merge tag 'execve-v7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull execve updates from Kees Cook: - use strnlen() in __set_task_comm (Thorsten Blum) - update task_struct->comm comment (Thorsten Blum) * tag 'execve-v7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: sched: update task_struct->comm comment exec: use strnlen() in __set_task_comm
2 parents cae0d23 + 9bf092c commit 613b48b

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

fs/exec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ static int unshare_sighand(struct task_struct *me)
10741074
*/
10751075
void __set_task_comm(struct task_struct *tsk, const char *buf, bool exec)
10761076
{
1077-
size_t len = min(strlen(buf), sizeof(tsk->comm) - 1);
1077+
size_t len = strnlen(buf, sizeof(tsk->comm) - 1);
10781078

10791079
trace_task_rename(tsk, buf);
10801080
memcpy(tsk->comm, buf, len);

include/linux/sched.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,12 +1163,9 @@ struct task_struct {
11631163
/*
11641164
* executable name, excluding path.
11651165
*
1166-
* - normally initialized begin_new_exec()
1167-
* - set it with set_task_comm()
1168-
* - strscpy_pad() to ensure it is always NUL-terminated and
1169-
* zero-padded
1170-
* - task_lock() to ensure the operation is atomic and the name is
1171-
* fully updated.
1166+
* - normally initialized by begin_new_exec()
1167+
* - set it with set_task_comm() to ensure it is always
1168+
* NUL-terminated and zero-padded
11721169
*/
11731170
char comm[TASK_COMM_LEN];
11741171

0 commit comments

Comments
 (0)