From 057a6c9ebb05e1bc0fba5880be50bc8564953c39 Mon Sep 17 00:00:00 2001 From: Tyler Smith <74526874+tylertms@users.noreply.github.com> Date: Tue, 3 Nov 2026 03:12:32 +0000 Subject: [PATCH] build(linux): link original task-name updates --- crates/stela-linux/build/native.rs | 1 + third_party/linux.sparse | 2 + .../linux/0024-separate-original-task.patch | 81 +++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 third_party/patches/linux/0024-separate-original-task.patch diff --git a/crates/stela-linux/build/native.rs b/crates/stela-linux/build/native.rs index fde8dfe6e9..5e356b0e56 100644 --- a/crates/stela-linux/build/native.rs +++ b/crates/stela-linux/build/native.rs @@ -175,6 +175,7 @@ impl Linux { PathBuf::from(format!("{LINUX}/kernel/rcu/rcuwait_finish.c")), PathBuf::from(format!("{LINUX}/fs/seq_output.c")), PathBuf::from(format!("{LINUX}/fs/seq_lifetime.c")), + PathBuf::from(format!("{LINUX}/fs/task_comm.c")), PathBuf::from(format!("{LINUX}/lib/maple_tree.c")), ]; let mut upstream = upstream; diff --git a/third_party/linux.sparse b/third_party/linux.sparse index 96c6d90208..8cd20e436d 100644 --- a/third_party/linux.sparse +++ b/third_party/linux.sparse @@ -89,6 +89,8 @@ /kernel/locking/Makefile /fs/seq_file.c /fs/seq_lifetime.c +/fs/exec.c +/fs/task_comm.c /fs/Makefile /fs/seq_output.c /fs/seq_output.h diff --git a/third_party/patches/linux/0024-separate-original-task.patch b/third_party/patches/linux/0024-separate-original-task.patch new file mode 100644 index 0000000000..c593620eb9 --- /dev/null +++ b/third_party/patches/linux/0024-separate-original-task.patch @@ -0,0 +1,81 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tyler Smith <74526874+tylertms@users.noreply.github.com> +Date: Mon, 2 Nov 2026 22:11:01 -0500 +Subject: [PATCH] refactor(exec): separate original task-name update + +--- + fs/Makefile | 2 +- + fs/exec.c | 14 -------------- + fs/task_comm.c | 25 +++++++++++++++++++++++++ + 3 files changed, 26 insertions(+), 15 deletions(-) + create mode 100644 fs/task_comm.c + +diff --git a/fs/Makefile b/fs/Makefile +index b2897388e0c312b47508b63d1c0350361e3d5f2c..416f56e7e154592c6e3eec54b17722cb799983ee 100644 +--- a/fs/Makefile ++++ b/fs/Makefile +@@ -8,7 +8,7 @@ + + + obj-y := open.o read_write.o file_table.o super.o \ +- char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \ ++ char_dev.o stat.o exec.o task_comm.o pipe.o namei.o fcntl.o \ + ioctl.o readdir.o select.o dcache.o inode.o \ + attr.o bad_inode.o file.o init_fdtable.o filesystems.o namespace.o \ + seq_file.o seq_lifetime.o seq_output.o xattr.o libfs.o fs-writeback.o \ +diff --git a/fs/exec.c b/fs/exec.c +index a598d48b5ffccb35fcb133fe1c8ec3e7c5c64b64..fd21bea6bb8aa9890af133a207e0e9625af87e93 100644 +--- a/fs/exec.c ++++ b/fs/exec.c +@@ -1091,20 +1091,6 @@ static int unshare_sighand(struct task_struct *me) + return 0; + } + +-/* +- * This is unlocked -- the string will always be NUL-terminated, but +- * may show overlapping contents if racing concurrent reads. +- */ +-void __set_task_comm(struct task_struct *tsk, const char *buf, bool exec) +-{ +- size_t len = strnlen(buf, sizeof(tsk->comm) - 1); +- +- trace_task_rename(tsk, buf); +- memcpy(tsk->comm, buf, len); +- memset(&tsk->comm[len], 0, sizeof(tsk->comm) - len); +- perf_event_comm(tsk, exec); +-} +- + static void posixtimer_exec(struct task_struct *me) + { + #ifdef CONFIG_POSIX_TIMERS +diff --git a/fs/task_comm.c b/fs/task_comm.c +new file mode 100644 +index 0000000000000000000000000000000000000000..82f79a5787383019d8cf0a8bbaf6c4006e38218f +--- /dev/null ++++ b/fs/task_comm.c +@@ -0,0 +1,25 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * linux/fs/exec.c ++ * ++ * Copyright (C) 1991, 1992 Linus Torvalds ++ */ ++ ++#include ++#include ++#include ++#include ++ ++/* ++ * This is unlocked -- the string will always be NUL-terminated, but ++ * may show overlapping contents if racing concurrent reads. ++ */ ++void __set_task_comm(struct task_struct *tsk, const char *buf, bool exec) ++{ ++ size_t len = strnlen(buf, sizeof(tsk->comm) - 1); ++ ++ trace_task_rename(tsk, buf); ++ memcpy(tsk->comm, buf, len); ++ memset(&tsk->comm[len], 0, sizeof(tsk->comm) - len); ++ perf_event_comm(tsk, exec); ++}