diff options
-rw-r--r-- | fs/exec.c | 7 | ||||
-rw-r--r-- | include/trace/events/sched.h | 2 |
2 files changed, 5 insertions, 4 deletions
@@ -1370,7 +1370,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | |||
1370 | unsigned int depth = bprm->recursion_depth; | 1370 | unsigned int depth = bprm->recursion_depth; |
1371 | int try,retval; | 1371 | int try,retval; |
1372 | struct linux_binfmt *fmt; | 1372 | struct linux_binfmt *fmt; |
1373 | pid_t old_pid; | 1373 | pid_t old_pid, old_vpid; |
1374 | 1374 | ||
1375 | retval = security_bprm_check(bprm); | 1375 | retval = security_bprm_check(bprm); |
1376 | if (retval) | 1376 | if (retval) |
@@ -1381,8 +1381,9 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | |||
1381 | return retval; | 1381 | return retval; |
1382 | 1382 | ||
1383 | /* Need to fetch pid before load_binary changes it */ | 1383 | /* Need to fetch pid before load_binary changes it */ |
1384 | old_pid = current->pid; | ||
1384 | rcu_read_lock(); | 1385 | rcu_read_lock(); |
1385 | old_pid = task_pid_nr_ns(current, task_active_pid_ns(current->parent)); | 1386 | old_vpid = task_pid_nr_ns(current, task_active_pid_ns(current->parent)); |
1386 | rcu_read_unlock(); | 1387 | rcu_read_unlock(); |
1387 | 1388 | ||
1388 | retval = -ENOENT; | 1389 | retval = -ENOENT; |
@@ -1405,7 +1406,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | |||
1405 | if (retval >= 0) { | 1406 | if (retval >= 0) { |
1406 | if (depth == 0) { | 1407 | if (depth == 0) { |
1407 | trace_sched_process_exec(current, old_pid, bprm); | 1408 | trace_sched_process_exec(current, old_pid, bprm); |
1408 | ptrace_event(PTRACE_EVENT_EXEC, old_pid); | 1409 | ptrace_event(PTRACE_EVENT_EXEC, old_vpid); |
1409 | } | 1410 | } |
1410 | put_binfmt(fmt); | 1411 | put_binfmt(fmt); |
1411 | allow_write_access(bprm->file); | 1412 | allow_write_access(bprm->file); |
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index fbc7b1ad929b..ea7a2035456d 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h | |||
@@ -295,7 +295,7 @@ TRACE_EVENT(sched_process_exec, | |||
295 | TP_fast_assign( | 295 | TP_fast_assign( |
296 | __assign_str(filename, bprm->filename); | 296 | __assign_str(filename, bprm->filename); |
297 | __entry->pid = p->pid; | 297 | __entry->pid = p->pid; |
298 | __entry->old_pid = p->pid; | 298 | __entry->old_pid = old_pid; |
299 | ), | 299 | ), |
300 | 300 | ||
301 | TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename), | 301 | TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename), |