Re: [PATCH 2/3 RESEND] ptrace: cleanup address space conversion onptrace_request()

From: Christoph Hellwig
Date: Mon Aug 23 2010 - 12:21:12 EST


On Tue, Aug 24, 2010 at 01:06:15AM +0900, Namhyung Kim wrote:
> In some cases 'data' should be considered as a user pointer but it requires
> cast with additional __force markup which was missing. Rather than add the
> markups wherever needed, make use of a temporary variable of user pointer.
> This patch is based on compat_ptrace_request() implementation.
>
> Suggested-by: Arnd Bergmann <arnd@xxxxxxxx>
> Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxx>
> ---
> kernel/ptrace.c | 13 +++++++------
> 1 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/ptrace.c b/kernel/ptrace.c
> index 4afd9b8..7547b1c 100644
> --- a/kernel/ptrace.c
> +++ b/kernel/ptrace.c
> @@ -564,6 +564,7 @@ int ptrace_request(struct task_struct *child, long request,
> {
> int ret = -EIO;
> siginfo_t siginfo;
> + unsigned long __user *datap = (unsigned long __user __force *) data;

Just make this a

void __user *datap = (void __user *)data;

and you can pass it around withjout additional casts. Also no need
for the force here I think.

You'll still need a cast for the put_user calls, or you could just
convert them to copy_to_user which is fine with a void pointer.
--
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/