[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <48bb7c89-abb9-1e88-fee3-fb42d4032d12@nh2.me>
Date: Sun, 17 Feb 2019 02:47:29 +0100
From: Niklas Hambüchen <mail@....me>
To: linux-kernel@...r.kernel.org
Cc: cleverca22@...il.com
Subject: ptrace() with multithreaded tracer
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 :)
Powered by blists - more mailing lists