Re: ptrace PTRACE_PEEKUSER behavior

From: Roland McGrath
Date: Thu May 08 2008 - 15:45:20 EST


>
> Quoting Roland McGrath <roland@xxxxxxxxxx>:
>
> > 'struct user' is really a virtual structure layout, and never exists
> > anywhere as an actual struct. It's really just defining the argument
> > values that can be used in PEEKUSR/POKEUSR calls.
>
> But the powerpc ptrace code returns the FPRs & FPSCR though they are
> not part of user struct.

I guess I was too strong in describing 'struct user' as useful even in that
sense. Each arch defines the offset values for its PEEKUSR/POKEUSR, and on
powerpc the asm/ptrace.h PT_* macros are the only true definition of that ABI.

'struct user' is used in a.out core dumps, if those can even still be
generated on powerpc. Other than that, the struct is actually meaningless
cruft on powerpc. On other machines it's almost that, except that e.g. on
x86 there is no other definition than offsetof(struct user, u_debugreg[0])
to supply that offset for PTRACE_POKEUSR.

> Does this mandate inclusion of floating point set in powerpc user struct?

I think what it mandates is dropping any idea that 'struct user' is
necessarily meaningful in any generic sense. The only use it has is
arch-specific cases where offsetof(struct user, something) is part of the
ptrace ABI.


Thanks,
Roland
--
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/