lkml.org 
[lkml]   [2010]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [patch v2 4/4] ptrace: Add support for generic PTRACE_GETREGSET/PTRACE_SETREGSET
Date
> +static int ptrace_regset(struct task_struct *task, int req, unsigned int type,
> + struct iovec *uiov)
^__user
> +{
> + const struct user_regset_view *view = task_user_regset_view(task);
> + const struct user_regset *regset = find_regset(view, type);
> + struct iovec kiov;
> +
> + if (!regset)
> + return -EIO;
> +
> + if (copy_from_user(&kiov, uiov, sizeof kiov))
> + return -EFAULT;

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.


Thanks,
Roland


\
 
 \ /
  Last update: 2010-02-10 20:15    [W:0.727 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site