[lkml]   [2019]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectptrace() with multithreaded tracer

it would be awesome if somebody in the know could confirm or refute a suspicion on ptrace() that we have.

The man page says:

Attachment and subsequent commands are per thread:
in a multi‐ threaded process, every thread can be individually attached to a
(potentially different) tracer, or left not attached and thus not debugged.
Therefore, "tracee" always means "(one) thread", never "a (possibly
multithreaded) process".

While the first sentence "Attachment ... [is] per thread" is quite general, the rest talks only about the multi-threadedness of the *tracee*.

What about multithreaded *tracers*?

We suspect (and observe program behaviour that supports this) that having one thread pA_t1 in a process A become the tracer of some tracee thread pB_t1, and then a different thread of A, pA_t2 running a `ptrace(pB_t1, ...)` is illegal and results in `ESRCH`.

Is this statement in true in general, or are there nuances?


PS: We'd be happy to contribute these details to the man page based on an answer :)

 \ /
  Last update: 2019-02-17 02:55    [W:0.109 / U:1.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site