aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/exec.c21
-rw-r--r--include/linux/binfmts.h1
-rw-r--r--include/linux/sched.h2
-rw-r--r--include/trace/events/task.h2
4 files changed, 4 insertions, 22 deletions
diff --git a/fs/exec.c b/fs/exec.c
index b60ccf969a8b..9e81c630dfa7 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1046,7 +1046,7 @@ EXPORT_SYMBOL_GPL(get_task_comm);
1046 * so that a new one can be started 1046 * so that a new one can be started
1047 */ 1047 */
1048 1048
1049void set_task_comm(struct task_struct *tsk, char *buf) 1049void set_task_comm(struct task_struct *tsk, const char *buf)
1050{ 1050{
1051 task_lock(tsk); 1051 task_lock(tsk);
1052 trace_task_rename(tsk, buf); 1052 trace_task_rename(tsk, buf);
@@ -1055,21 +1055,6 @@ void set_task_comm(struct task_struct *tsk, char *buf)
1055 perf_event_comm(tsk); 1055 perf_event_comm(tsk);
1056} 1056}
1057 1057
1058static void filename_to_taskname(char *tcomm, const char *fn, unsigned int len)
1059{
1060 int i, ch;
1061
1062 /* Copies the binary name from after last slash */
1063 for (i = 0; (ch = *(fn++)) != '\0';) {
1064 if (ch == '/')
1065 i = 0; /* overwrite what we wrote */
1066 else
1067 if (i < len - 1)
1068 tcomm[i++] = ch;
1069 }
1070 tcomm[i] = '\0';
1071}
1072
1073int flush_old_exec(struct linux_binprm * bprm) 1058int flush_old_exec(struct linux_binprm * bprm)
1074{ 1059{
1075 int retval; 1060 int retval;
@@ -1083,8 +1068,6 @@ int flush_old_exec(struct linux_binprm * bprm)
1083 goto out; 1068 goto out;
1084 1069
1085 set_mm_exe_file(bprm->mm, bprm->file); 1070 set_mm_exe_file(bprm->mm, bprm->file);
1086
1087 filename_to_taskname(bprm->tcomm, bprm->filename, sizeof(bprm->tcomm));
1088 /* 1071 /*
1089 * Release all of the old mmap stuff 1072 * Release all of the old mmap stuff
1090 */ 1073 */
@@ -1127,7 +1110,7 @@ void setup_new_exec(struct linux_binprm * bprm)
1127 else 1110 else
1128 set_dumpable(current->mm, suid_dumpable); 1111 set_dumpable(current->mm, suid_dumpable);
1129 1112
1130 set_task_comm(current, bprm->tcomm); 1113 set_task_comm(current, kbasename(bprm->filename));
1131 1114
1132 /* Set the new mm task size. We have to do that late because it may 1115 /* Set the new mm task size. We have to do that late because it may
1133 * depend on TIF_32BIT which is only updated in flush_thread() on 1116 * depend on TIF_32BIT which is only updated in flush_thread() on
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index b4a745d7d9a9..61f29e5ea840 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -44,7 +44,6 @@ struct linux_binprm {
44 unsigned interp_flags; 44 unsigned interp_flags;
45 unsigned interp_data; 45 unsigned interp_data;
46 unsigned long loader, exec; 46 unsigned long loader, exec;
47 char tcomm[TASK_COMM_LEN];
48}; 47};
49 48
50#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 49#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 6c70645eb3b6..f8497059f88c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2357,7 +2357,7 @@ extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, i
2357struct task_struct *fork_idle(int); 2357struct task_struct *fork_idle(int);
2358extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); 2358extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
2359 2359
2360extern void set_task_comm(struct task_struct *tsk, char *from); 2360extern void set_task_comm(struct task_struct *tsk, const char *from);
2361extern char *get_task_comm(char *to, struct task_struct *tsk); 2361extern char *get_task_comm(char *to, struct task_struct *tsk);
2362 2362
2363#ifdef CONFIG_SMP 2363#ifdef CONFIG_SMP
diff --git a/include/trace/events/task.h b/include/trace/events/task.h
index 102a646e1996..dee3bb1d5a6b 100644
--- a/include/trace/events/task.h
+++ b/include/trace/events/task.h
@@ -32,7 +32,7 @@ TRACE_EVENT(task_newtask,
32 32
33TRACE_EVENT(task_rename, 33TRACE_EVENT(task_rename,
34 34
35 TP_PROTO(struct task_struct *task, char *comm), 35 TP_PROTO(struct task_struct *task, const char *comm),
36 36
37 TP_ARGS(task, comm), 37 TP_ARGS(task, comm),
38 38