diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/exec.c | 21 |
1 files changed, 2 insertions, 19 deletions
@@ -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 | ||
1049 | void set_task_comm(struct task_struct *tsk, char *buf) | 1049 | void 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 | ||
1058 | static 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 | |||
1073 | int flush_old_exec(struct linux_binprm * bprm) | 1058 | int 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 |