Skip to contentSkip to conversation

security-replace-memcpy-with-get_task_comm.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Nov 6, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: security: replace memcpy() with get_task_comm()
has been removed from the -mm tree. Its filename was
security-replace-memcpy-with-get_task_comm.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Yafang Shao <[email protected]>
Subject: security: replace memcpy() with get_task_comm()
Date: Mon, 7 Oct 2024 22:49:07 +0800

Quoted from Linus [0]:

selinux never wanted a lock, and never wanted any kind of *consistent* result, it just wanted a *stable* result.

Using get_task_comm() to read the task comm ensures that the name is always NUL-terminated, regardless of the source string. This approach also facilitates future extensions to the task comm.

Cc James Morris <[email protected]>
Cc "Serge E. Hallyn" <[email protected]>
Cc Stephen Smalley <[email protected]>
Cc Ondrej Mosnacek <[email protected]>
Cc Alejandro Colomar <[email protected]>
Cc Alexander Viro <[email protected]>
Cc Alexei Starovoitov <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Christian Brauner <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>
Cc Eric Biederman <[email protected]>
Cc Eric Paris <[email protected]>
Cc Jan Kara <[email protected]>
Cc Justin Stitt <[email protected]>
Cc Kees Cook <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Matus Jokay <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Quentin Monnet <[email protected]>
Cc Simon Horman <[email protected]>
Cc Steven Rostedt (Google) <[email protected]>
Cc Tetsuo Handa <[email protected]>
Cc Thomas Zimmermann <[email protected]>

---

 security/lsm_audit.c         |    4 ++--
 security/selinux/selinuxfs.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
security/lsm_audit.c renamed from security/lsm_audit.c~security-replace-memcpy-with-get_task_comm +2 -2
@@ -207,7 +207,7 @@ static void dump_common_audit_data(struc
 	BUILD_BUG_ON(sizeof(a->u) > sizeof(void *)*2);
 
 	audit_log_format(ab, " pid=%d comm=", task_tgid_nr(current));
-	audit_log_untrustedstring(ab, memcpy(comm, current->comm, sizeof(comm)));
+	audit_log_untrustedstring(ab, get_task_comm(comm, current));
 
 	switch (a->type) {
 	case LSM_AUDIT_DATA_NONE:
@@ -302,7 +302,7 @@ static void dump_common_audit_data(struc
 				char comm[sizeof(tsk->comm)];
 				audit_log_format(ab, " opid=%d ocomm=", pid);
 				audit_log_untrustedstring(ab,
-				    memcpy(comm, tsk->comm, sizeof(comm)));
+				    get_task_comm(comm, tsk));
 			}
 		}
 		break;
security/selinux/selinuxfs.c renamed from security/selinux/selinuxfs.c~security-replace-memcpy-with-get_task_comm +1 -1
@@ -708,7 +708,7 @@ static ssize_t sel_write_checkreqprot(st
 	if (new_value) {
 		char comm[sizeof(current->comm)];
 
-		memcpy(comm, current->comm, sizeof(comm));
+		strscpy(comm, current->comm);
 		pr_err("SELinux: %s (%d) set checkreqprot to 1. This is no longer supported.\n",
 		       comm, current->pid);
 	}

_

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