public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* ptrace() with multithreaded tracer
@ 2019-02-17  1:47 Niklas Hambüchen
  2019-02-17 16:34 ` [PATCH] ptrace.2: Improve clarity for multi-threaded tracers Niklas Hambüchen
  0 siblings, 1 reply; 6+ messages in thread
From: Niklas Hambüchen @ 2019-02-17  1:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: cleverca22

Hello,

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?

Thanks,
Niklas


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-04-21 15:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-17  1:47 ptrace() with multithreaded tracer Niklas Hambüchen
2019-02-17 16:34 ` [PATCH] ptrace.2: Improve clarity for multi-threaded tracers Niklas Hambüchen
2019-02-17 22:15   ` Dmitry V. Levin
2019-02-25 15:51     ` Michael Kerrisk (man-pages)
2019-04-21 14:58       ` Niklas Hambüchen
2019-04-21 14:57     ` Niklas Hambüchen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox