Commit 613b48bb authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents cae0d232 9bf092c9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1074,7 +1074,7 @@ static int unshare_sighand(struct task_struct *me)
 */
void __set_task_comm(struct task_struct *tsk, const char *buf, bool exec)
{
	size_t len = min(strlen(buf), sizeof(tsk->comm) - 1);
	size_t len = strnlen(buf, sizeof(tsk->comm) - 1);

	trace_task_rename(tsk, buf);
	memcpy(tsk->comm, buf, len);
+3 −6
Original line number Diff line number Diff line
@@ -1163,12 +1163,9 @@ struct task_struct {
	/*
	 * executable name, excluding path.
	 *
	 * - normally initialized begin_new_exec()
	 * - set it with set_task_comm()
	 *   - strscpy_pad() to ensure it is always NUL-terminated and
	 *     zero-padded
	 *   - task_lock() to ensure the operation is atomic and the name is
	 *     fully updated.
	 * - normally initialized by begin_new_exec()
	 * - set it with set_task_comm() to ensure it is always
	 *   NUL-terminated and zero-padded
	 */
	char				comm[TASK_COMM_LEN];