All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Namhyung Kim <namhyung@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Roland McGrath <roland@redhat.com>,
	Oleg Nesterov <oleg@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3 RESEND] ptrace: cleanup address space conversion on ptrace_request()
Date: Mon, 23 Aug 2010 12:21:05 -0400	[thread overview]
Message-ID: <20100823162105.GA19164@infradead.org> (raw)
In-Reply-To: <1282579575-9189-1-git-send-email-namhyung@gmail.com>

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@arndb.de>
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
>  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.

  reply	other threads:[~2010-08-23 16:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-22 10:22 [PATCH 2/3] ptrace: add __force markup Namhyung Kim
2010-08-22 20:06 ` Arnd Bergmann
2010-08-23 16:06   ` [PATCH 2/3 RESEND] ptrace: cleanup address space conversion on ptrace_request() Namhyung Kim
2010-08-23 16:21     ` Christoph Hellwig [this message]
2010-08-23 16:38       ` Namhyung Kim
2010-08-24 11:45         ` Arnd Bergmann
2010-08-25  7:48           ` Namhyung Kim
2010-08-25 11:42             ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100823162105.GA19164@infradead.org \
    --to=hch@infradead.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@gmail.com \
    --cc=oleg@redhat.com \
    --cc=roland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.