Re: [PATCH] ptrace: make former thread ID available viaPTRACE_GETEVENTMSG after PTRACE_EVENT_EXEC stop (v.2)
From: Denys Vlasenko
Date: Mon Jun 27 2011 - 20:34:11 EST
On Sun, Jun 26, 2011 at 10:04 PM, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
>> + pid_t old_pid = old_pid; /* for compiler */
>
> we have uninitialized_var() for this,
>
> pid_t uninitialized_var(old_pid);
>
>> - retval = fn(bprm, regs);
>> + if (task_ptrace(current) & PT_PTRACED) {
>
> May be PT_TRACE_EXEC makes more sense. Note that ptrace_event_enabled() was
> recently added.
>
>> + /* Need to fetch pid before load_binary changes it */
>> + rcu_read_lock();
>> + old_pid = task_pid_nr_ns(current, task_active_pid_ns(current->parent));
>
> OK, this looks correct. But imho this code looks strange inside the
> for (;;) loop. Perhaps it would be more clean to record the old pid
> before.
>
>> if (depth == 0)
>> - tracehook_report_exec(fmt, bprm, regs);
>> + tracehook_report_exec(fmt, bprm, regs, old_pid);
>
> Heh, you are out of luck ;) This hook was already killed. Please redo
> against git://git.kernel.org/pub/scm/linux/kernel/git/oleg/misc.git ptrace
I just sent rediffed version against this branch as a separate mail.
I think I addressed all your concerns in it.
--
vda
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/