diff options
author | Olof Johansson <olof@lixom.net> | 2012-02-10 15:40:34 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-02-10 15:40:34 -0500 |
commit | 082f53c2f573c75a8f1610c587a43b6817e20f90 (patch) | |
tree | c3ad3a58967e7f7f61ff12ff59284dba1e76d093 /fs/exec.c | |
parent | e69128b947da0a2474447868f73c76311e2baedb (diff) | |
parent | b024e33682c8e56cc8e869245dabd1b91ffe00ea (diff) |
Merge branch 'for-arm-soc' of git://sources.calxeda.com/kernel/linux into next/soc
* 'for-arm-soc' of git://sources.calxeda.com/kernel/linux: (247 commits)
ARM: highbank: remove unused memory.h
ARM: highbank: enable sp804 based sched_clock
ARM: timer-sp: add sched_clock support
Linux 3.3-rc3
pcmcia: fix socket refcount decrementing on each resume
mm: fix UP THP spin_is_locked BUGs
drivers/leds/leds-lm3530.c: fix setting pltfm->als_vmax
mm: compaction: check for overlapping nodes during isolation for migration
nilfs2: avoid overflowing segment numbers in nilfs_ioctl_clean_segments()
ASoC: wm8994: Disable line output discharge prior to ramping VMID
ASoC: wm8994: Fix typo in VMID ramp setting
ALSA: oxygen, virtuoso: fix exchanged L/R volumes of aux and CD inputs
ALSA: usb-audio: add Edirol UM-3G support
checkpatch: Warn on code with 6+ tab indentation
ACPI: remove duplicated lines of merging problems with acpi_processor_add
ALSA: hda - add support for Uniwill ECS M31EI notebook
HID: wiimote: fix invalid power_supply_powers call
ALSA: hda - Fix error handling in patch_ca0132.c
target: Fix unsupported WRITE_SAME sense payload
iscsi: use IP_FREEBIND socket option
...
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 33 |
1 files changed, 17 insertions, 16 deletions
@@ -1071,6 +1071,21 @@ void set_task_comm(struct task_struct *tsk, char *buf) | |||
1071 | perf_event_comm(tsk); | 1071 | perf_event_comm(tsk); |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | static void filename_to_taskname(char *tcomm, const char *fn, unsigned int len) | ||
1075 | { | ||
1076 | int i, ch; | ||
1077 | |||
1078 | /* Copies the binary name from after last slash */ | ||
1079 | for (i = 0; (ch = *(fn++)) != '\0';) { | ||
1080 | if (ch == '/') | ||
1081 | i = 0; /* overwrite what we wrote */ | ||
1082 | else | ||
1083 | if (i < len - 1) | ||
1084 | tcomm[i++] = ch; | ||
1085 | } | ||
1086 | tcomm[i] = '\0'; | ||
1087 | } | ||
1088 | |||
1074 | int flush_old_exec(struct linux_binprm * bprm) | 1089 | int flush_old_exec(struct linux_binprm * bprm) |
1075 | { | 1090 | { |
1076 | int retval; | 1091 | int retval; |
@@ -1085,6 +1100,7 @@ int flush_old_exec(struct linux_binprm * bprm) | |||
1085 | 1100 | ||
1086 | set_mm_exe_file(bprm->mm, bprm->file); | 1101 | set_mm_exe_file(bprm->mm, bprm->file); |
1087 | 1102 | ||
1103 | filename_to_taskname(bprm->tcomm, bprm->filename, sizeof(bprm->tcomm)); | ||
1088 | /* | 1104 | /* |
1089 | * Release all of the old mmap stuff | 1105 | * Release all of the old mmap stuff |
1090 | */ | 1106 | */ |
@@ -1116,10 +1132,6 @@ EXPORT_SYMBOL(would_dump); | |||
1116 | 1132 | ||
1117 | void setup_new_exec(struct linux_binprm * bprm) | 1133 | void setup_new_exec(struct linux_binprm * bprm) |
1118 | { | 1134 | { |
1119 | int i, ch; | ||
1120 | const char *name; | ||
1121 | char tcomm[sizeof(current->comm)]; | ||
1122 | |||
1123 | arch_pick_mmap_layout(current->mm); | 1135 | arch_pick_mmap_layout(current->mm); |
1124 | 1136 | ||
1125 | /* This is the point of no return */ | 1137 | /* This is the point of no return */ |
@@ -1130,18 +1142,7 @@ void setup_new_exec(struct linux_binprm * bprm) | |||
1130 | else | 1142 | else |
1131 | set_dumpable(current->mm, suid_dumpable); | 1143 | set_dumpable(current->mm, suid_dumpable); |
1132 | 1144 | ||
1133 | name = bprm->filename; | 1145 | set_task_comm(current, bprm->tcomm); |
1134 | |||
1135 | /* Copies the binary name from after last slash */ | ||
1136 | for (i=0; (ch = *(name++)) != '\0';) { | ||
1137 | if (ch == '/') | ||
1138 | i = 0; /* overwrite what we wrote */ | ||
1139 | else | ||
1140 | if (i < (sizeof(tcomm) - 1)) | ||
1141 | tcomm[i++] = ch; | ||
1142 | } | ||
1143 | tcomm[i] = '\0'; | ||
1144 | set_task_comm(current, tcomm); | ||
1145 | 1146 | ||
1146 | /* Set the new mm task size. We have to do that late because it may | 1147 | /* Set the new mm task size. We have to do that late because it may |
1147 | * depend on TIF_32BIT which is only updated in flush_thread() on | 1148 | * depend on TIF_32BIT which is only updated in flush_thread() on |