diff options
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 32 |
1 files changed, 17 insertions, 15 deletions
@@ -50,15 +50,12 @@ | |||
50 | #include <linux/cn_proc.h> | 50 | #include <linux/cn_proc.h> |
51 | #include <linux/audit.h> | 51 | #include <linux/audit.h> |
52 | #include <linux/tracehook.h> | 52 | #include <linux/tracehook.h> |
53 | #include <linux/kmod.h> | ||
53 | 54 | ||
54 | #include <asm/uaccess.h> | 55 | #include <asm/uaccess.h> |
55 | #include <asm/mmu_context.h> | 56 | #include <asm/mmu_context.h> |
56 | #include <asm/tlb.h> | 57 | #include <asm/tlb.h> |
57 | 58 | ||
58 | #ifdef CONFIG_KMOD | ||
59 | #include <linux/kmod.h> | ||
60 | #endif | ||
61 | |||
62 | #ifdef __alpha__ | 59 | #ifdef __alpha__ |
63 | /* for /sbin/loader handling in search_binary_handler() */ | 60 | /* for /sbin/loader handling in search_binary_handler() */ |
64 | #include <linux/a.out.h> | 61 | #include <linux/a.out.h> |
@@ -391,7 +388,7 @@ static int count(char __user * __user * argv, int max) | |||
391 | if (!p) | 388 | if (!p) |
392 | break; | 389 | break; |
393 | argv++; | 390 | argv++; |
394 | if(++i > max) | 391 | if (i++ >= max) |
395 | return -E2BIG; | 392 | return -E2BIG; |
396 | cond_resched(); | 393 | cond_resched(); |
397 | } | 394 | } |
@@ -825,8 +822,6 @@ static int de_thread(struct task_struct *tsk) | |||
825 | schedule(); | 822 | schedule(); |
826 | } | 823 | } |
827 | 824 | ||
828 | if (unlikely(task_child_reaper(tsk) == leader)) | ||
829 | task_active_pid_ns(tsk)->child_reaper = tsk; | ||
830 | /* | 825 | /* |
831 | * The only record we have of the real-time age of a | 826 | * The only record we have of the real-time age of a |
832 | * process, regardless of execs it's done, is start_time. | 827 | * process, regardless of execs it's done, is start_time. |
@@ -1164,6 +1159,7 @@ EXPORT_SYMBOL(remove_arg_zero); | |||
1164 | */ | 1159 | */ |
1165 | int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | 1160 | int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) |
1166 | { | 1161 | { |
1162 | unsigned int depth = bprm->recursion_depth; | ||
1167 | int try,retval; | 1163 | int try,retval; |
1168 | struct linux_binfmt *fmt; | 1164 | struct linux_binfmt *fmt; |
1169 | #ifdef __alpha__ | 1165 | #ifdef __alpha__ |
@@ -1189,7 +1185,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | |||
1189 | return retval; | 1185 | return retval; |
1190 | 1186 | ||
1191 | /* Remember if the application is TASO. */ | 1187 | /* Remember if the application is TASO. */ |
1192 | bprm->sh_bang = eh->ah.entry < 0x100000000UL; | 1188 | bprm->taso = eh->ah.entry < 0x100000000UL; |
1193 | 1189 | ||
1194 | bprm->file = file; | 1190 | bprm->file = file; |
1195 | bprm->loader = loader; | 1191 | bprm->loader = loader; |
@@ -1224,8 +1220,15 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | |||
1224 | continue; | 1220 | continue; |
1225 | read_unlock(&binfmt_lock); | 1221 | read_unlock(&binfmt_lock); |
1226 | retval = fn(bprm, regs); | 1222 | retval = fn(bprm, regs); |
1223 | /* | ||
1224 | * Restore the depth counter to its starting value | ||
1225 | * in this call, so we don't have to rely on every | ||
1226 | * load_binary function to restore it on return. | ||
1227 | */ | ||
1228 | bprm->recursion_depth = depth; | ||
1227 | if (retval >= 0) { | 1229 | if (retval >= 0) { |
1228 | tracehook_report_exec(fmt, bprm, regs); | 1230 | if (depth == 0) |
1231 | tracehook_report_exec(fmt, bprm, regs); | ||
1229 | put_binfmt(fmt); | 1232 | put_binfmt(fmt); |
1230 | allow_write_access(bprm->file); | 1233 | allow_write_access(bprm->file); |
1231 | if (bprm->file) | 1234 | if (bprm->file) |
@@ -1247,8 +1250,8 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | |||
1247 | read_unlock(&binfmt_lock); | 1250 | read_unlock(&binfmt_lock); |
1248 | if (retval != -ENOEXEC || bprm->mm == NULL) { | 1251 | if (retval != -ENOEXEC || bprm->mm == NULL) { |
1249 | break; | 1252 | break; |
1250 | #ifdef CONFIG_KMOD | 1253 | #ifdef CONFIG_MODULES |
1251 | }else{ | 1254 | } else { |
1252 | #define printable(c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e)) | 1255 | #define printable(c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e)) |
1253 | if (printable(bprm->buf[0]) && | 1256 | if (printable(bprm->buf[0]) && |
1254 | printable(bprm->buf[1]) && | 1257 | printable(bprm->buf[1]) && |
@@ -1391,7 +1394,7 @@ EXPORT_SYMBOL(set_binfmt); | |||
1391 | * name into corename, which must have space for at least | 1394 | * name into corename, which must have space for at least |
1392 | * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator. | 1395 | * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator. |
1393 | */ | 1396 | */ |
1394 | static int format_corename(char *corename, int nr_threads, long signr) | 1397 | static int format_corename(char *corename, long signr) |
1395 | { | 1398 | { |
1396 | const char *pat_ptr = core_pattern; | 1399 | const char *pat_ptr = core_pattern; |
1397 | int ispipe = (*pat_ptr == '|'); | 1400 | int ispipe = (*pat_ptr == '|'); |
@@ -1498,8 +1501,7 @@ static int format_corename(char *corename, int nr_threads, long signr) | |||
1498 | * If core_pattern does not include a %p (as is the default) | 1501 | * If core_pattern does not include a %p (as is the default) |
1499 | * and core_uses_pid is set, then .%pid will be appended to | 1502 | * and core_uses_pid is set, then .%pid will be appended to |
1500 | * the filename. Do not do this for piped commands. */ | 1503 | * the filename. Do not do this for piped commands. */ |
1501 | if (!ispipe && !pid_in_pattern | 1504 | if (!ispipe && !pid_in_pattern && core_uses_pid) { |
1502 | && (core_uses_pid || nr_threads)) { | ||
1503 | rc = snprintf(out_ptr, out_end - out_ptr, | 1505 | rc = snprintf(out_ptr, out_end - out_ptr, |
1504 | ".%d", task_tgid_vnr(current)); | 1506 | ".%d", task_tgid_vnr(current)); |
1505 | if (rc > out_end - out_ptr) | 1507 | if (rc > out_end - out_ptr) |
@@ -1762,7 +1764,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs) | |||
1762 | * uses lock_kernel() | 1764 | * uses lock_kernel() |
1763 | */ | 1765 | */ |
1764 | lock_kernel(); | 1766 | lock_kernel(); |
1765 | ispipe = format_corename(corename, retval, signr); | 1767 | ispipe = format_corename(corename, signr); |
1766 | unlock_kernel(); | 1768 | unlock_kernel(); |
1767 | /* | 1769 | /* |
1768 | * Don't bother to check the RLIMIT_CORE value if core_pattern points | 1770 | * Don't bother to check the RLIMIT_CORE value if core_pattern points |