[PATCH 01/10] Scrub executable name for each user process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Walk all processes via the tasks lists starting from init_task

   extern struct task_struct init_task;

   struct task_struct {
        ...
        struct list_head tasks;
        ...
        char comm[TASK_COMM_LEN]; /* executable name excluding path */
        ...
   };

For each user space process clear executable name

   struct task_struct *tsk;
   list_for_each_entry(tsk, &init_task, tasks) {
       if (tsk->mm)
           memset(tsk->comm, 0, TASK_COMM_LEN);
   }


Signed-off-by: Aruna Balakrishnaiah <aruna at linux.vnet.ibm.com>
---
 eppic_scripts/proc_names.c |   49 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 eppic_scripts/proc_names.c

diff --git a/eppic_scripts/proc_names.c b/eppic_scripts/proc_names.c
new file mode 100644
index 0000000..12876df
--- /dev/null
+++ b/eppic_scripts/proc_names.c
@@ -0,0 +1,49 @@
+string
+proc_opt()
+{
+	    return "l";
+}
+
+string
+proc_usage()
+{
+	    return "\n";
+}
+
+static void
+proc_showusage()
+{
+	    printf("usage : proc %s", proc_usage());
+}
+
+string
+proc_help()
+{
+	    return "Help";
+}
+
+int
+proc()
+{
+	struct list_head *head, *next;
+	struct task_struct *tsk;
+
+	tsk = &init_task;
+
+	head = (struct list_head *) &(tsk->tasks);
+	next = (struct list_head *) tsk->tasks.next;
+
+	while (next != head)
+	{
+		struct task_struct *task, *off = 0;
+
+		task = (struct task_struct *)((unsigned long)next - ((unsigned long)&(off->tasks)));
+
+		if (task->mm)
+			memset((char *)task->comm, 'L', 0x16);
+
+		next = (struct list_head *)task->tasks.next;
+	}
+
+	return 1;
+}




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux