Re: [PATCH] ptrace: add ability to get clear_tid_address

From: Jamie Lokier
Date: Thu Feb 09 2012 - 22:03:41 EST


Jan Kratochvil wrote:
> On Wed, 08 Feb 2012 14:41:45 +0100, Andrew Vagin wrote:
> > I want to say, that when you have trouble with child_tid_address,
> > you may want to get it.
> > If the code is your, you may get it via prctl, but if it's not, what
> > will you do?
>
> GDB does PTRACE_ARCH_PRCTL (amd64-linux-nat.c) - without inserting any code
> into the debuggee. How it can be simplified more?

That's x86-64 only, (although bizarrely it looks like 32-bit tasks can
use it too, if running on a 64-bit kernel).

Whereas child_tid_address is for all architectures.

We've already got a whole syscall, get_robust_list(), which fetches
that address from a remote process if you have ptrace permission, and
you don't even need to be ptracing it! get_robust_list() is quite
large, and most of it is permission checks. How often is that useful?

I don't see why getting the child_tid_address should be a big deal.

On the other hand, lots of little bits of info would be handy to a
ptracer sometimes, such as the current signal mask and prctl settings.

Maybe what's needed is a generic PTRACE_PRCTL, allowed to call a
subset of prctl() functions from outside, or maybe even all of them.

Then add child_tid_address as a prctl.

( Then again maybe just skip the messing around that everyone does with
"parasite" code, and go straight for PTRACE_CALL_SYSCALL. It'd save a
lot of bother :-) )

All the best,
-- Jamie
--
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/