aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/exec.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/exec.c b/fs/exec.c
index c3d517bfdd27..b08367abf30e 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1358,6 +1358,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
1358 unsigned int depth = bprm->recursion_depth; 1358 unsigned int depth = bprm->recursion_depth;
1359 int try,retval; 1359 int try,retval;
1360 struct linux_binfmt *fmt; 1360 struct linux_binfmt *fmt;
1361 pid_t old_pid;
1361 1362
1362 retval = security_bprm_check(bprm); 1363 retval = security_bprm_check(bprm);
1363 if (retval) 1364 if (retval)
@@ -1371,6 +1372,11 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
1371 if (retval) 1372 if (retval)
1372 return retval; 1373 return retval;
1373 1374
1375 /* Need to fetch pid before load_binary changes it */
1376 rcu_read_lock();
1377 old_pid = task_pid_nr_ns(current, task_active_pid_ns(current->parent));
1378 rcu_read_unlock();
1379
1374 retval = -ENOENT; 1380 retval = -ENOENT;
1375 for (try=0; try<2; try++) { 1381 for (try=0; try<2; try++) {
1376 read_lock(&binfmt_lock); 1382 read_lock(&binfmt_lock);
@@ -1390,7 +1396,8 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
1390 bprm->recursion_depth = depth; 1396 bprm->recursion_depth = depth;
1391 if (retval >= 0) { 1397 if (retval >= 0) {
1392 if (depth == 0) 1398 if (depth == 0)
1393 ptrace_event(PTRACE_EVENT_EXEC, 0); 1399 ptrace_event(PTRACE_EVENT_EXEC,
1400 old_pid);
1394 put_binfmt(fmt); 1401 put_binfmt(fmt);
1395 allow_write_access(bprm->file); 1402 allow_write_access(bprm->file);
1396 if (bprm->file) 1403 if (bprm->file)