All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Dan Rosenberg <drosenberg@vsecurity.com>,
	chris@zankel.net, security@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [Security] [PATCH] xtensa: prevent arbitrary read in ptrace
Date: Fri, 8 Jul 2011 20:42:50 +0200	[thread overview]
Message-ID: <20110708184250.GA31307@redhat.com> (raw)
In-Reply-To: <20110708112706.9014d306.akpm@linux-foundation.org>

On 07/08, Andrew Morton wrote:
>
> On Thu, 07 Jul 2011 20:03:54 -0400
> Dan Rosenberg <drosenberg@vsecurity.com> wrote:
>
> > Prevent an arbitrary kernel read. Check the user pointer with
> > access_ok() before copying data in.
> >
> > Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>
> > Cc: stable@kernel.org
> > ---
> >  arch/xtensa/kernel/ptrace.c |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c
> > index c72c947..ddce75e 100644
> > --- a/arch/xtensa/kernel/ptrace.c
> > +++ b/arch/xtensa/kernel/ptrace.c
> > @@ -147,6 +147,9 @@ int ptrace_setxregs(struct task_struct *child, void __user *uregs)
> >  	elf_xtregs_t *xtregs = uregs;
> >  	int ret = 0;
> >
> > +	if (!access_ok(VERIFY_READ, uregs, sizeof(elf_xtregs_t)))
> > +		return -EIO;
>
> This should be -EFAULT, methinks?

Also, it seems that ptrace_setxregs/ptrace_getxregs could be static?

The patch looks "obviously correct" but I don't understand this code.

Hmm. We don't read/write the XTENSA_HAVE_COPROCESSORS data, but use
sizeof(elf_xtregs_t) anyway. This looks a bit strange but I guess
this doesn't matter.

Oleg.


  reply	other threads:[~2011-07-08 18:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-08  0:03 [PATCH] xtensa: prevent arbitrary read in ptrace Dan Rosenberg
2011-07-08 18:27 ` [Security] " Andrew Morton
2011-07-08 18:42   ` Oleg Nesterov [this message]
2011-07-08 19:29     ` Chris Zankel
  -- strict thread matches above, loose matches on Subject: below --
2011-07-08 18:35 Dan Rosenberg
2011-07-08 18:42 ` Andrew Morton

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=20110708184250.GA31307@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=chris@zankel.net \
    --cc=drosenberg@vsecurity.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=security@kernel.org \
    /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.