Re: [patch v2 4/4] ptrace: Add support for generic PTRACE_GETREGSET/PTRACE_SETREGSET

H. Peter Anvin
2010-02-11T02:17:41Z

On 02/10/2010 11:12 AM, Roland McGrath wrote:
>
> Since it's just two words, most places handling struct iovec seem to just
> use two get_user() calls, which is probably more efficient.
>
> Also, here is where this function would need to be split in half for
> compat_ptrace_request() calls where it has to use struct compat_iovec.
>
>> + // I am not sure. Afaics it is OK to pass the
>> + // size which is less than n * size. If iov_len
>> + // is bigger, we can silently truncate it, or
>> + // even write the correct value back.
>
> Modifying iov_len to report how much we accessed seems good to me. If we
> do that, we should certainly allow a larger size for get, so userland can
> just use a generic large buffer before even knowing the real size. I'm not
> sure whether we should allow a smaller size, especially for set. I could
> go either way.
>

Allowing a larger size for get seems very sane. Allowing a smaller size
would be ok iff we make sure we handle corner cases right (i.e. a
partially overwritten subregister.)

-hpa