On 06/02/2015 12:57 PM, Tony Zhang wrote:
> Hello,
>
> Is it possible to use DynInst from a different thread within a process?
> For example, a program would create multiple pthreads, and one of them
> (a master) then attempts to control the execution of all other threads
> in the program.
On Linux, Dyninst works through ptrace, and ptrace forbids attaching to
threads in your own thread group -- it will return EPERM.
See Linux's ptrace_attach() in kernel/ptrace.c, in particular:
retval = -EPERM;
if (unlikely(task->flags & PF_KTHREAD))
goto out;
if (same_thread_group(task, current))
goto out;
|