All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasiliy Kulikov <segoon@openwall.com>
To: Balbir Singh <bsingharora@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	David Rientjes <rientjes@google.com>,
	Stephen Wilson <wilsons@start.ca>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	security@kernel.org, Eric Paris <eparis@redhat.com>,
	Solar Designer <solar@openwall.com>
Subject: Re: [PATCH 2/2] taskstats: restrict access to user
Date: Thu, 30 Jun 2011 00:17:18 +0400	[thread overview]
Message-ID: <20110629201718.GA11071@albatros> (raw)
In-Reply-To: <BANLkTi=dTHGK1QVs+g2tA6WocQ64SPPF3g@mail.gmail.com>

On Wed, Jun 29, 2011 at 06:57 +0530, Balbir Singh wrote:
> On Fri, Jun 24, 2011 at 5:39 PM, Vasiliy Kulikov <segoon@openwall.com> wrote:
> > +               task = find_task_by_vpid(s->pid);
> > +               if (!task || __task_cred(task)->euid != cred->euid) {

If consider this patch for inclusion, it also needs some check for
the listener root ability.  __task_cred(task)->euid == 0 or smth like
that.  But ptrace_task_may_access_current() is better.

> > +                       rcu_read_unlock();
> > +                       continue;
> > +               }
> > +               rcu_read_unlock();
> > +
> 
> Release the lock prior to up_read()
> 
> >                skb_next = NULL;
> >                if (!list_is_last(&s->list, &listeners->list)) {
> >                        skb_next = skb_clone(skb_cur, GFP_KERNEL);
> > @@ -199,14 +211,19 @@ static void fill_stats(struct task_struct *tsk, struct taskstats *stats)
> >  static int fill_stats_for_pid(pid_t pid, struct taskstats *stats)
> >  {
> >        struct task_struct *tsk;
> > +       int rc = -ESRCH;
> >
> >        rcu_read_lock();
> >        tsk = find_task_by_vpid(pid);
> > +       if (tsk && !ptrace_may_access(tsk, PTRACE_MODE_READ)) {
> > +               tsk = NULL;
> > +               rc = -EACCES;
> > +       }
> >        if (tsk)
> >                get_task_struct(tsk);
> >        rcu_read_unlock();
> >        if (!tsk)
> > -               return -ESRCH;
> > +               return rc;
> >        fill_stats(tsk, stats);
> >        put_task_struct(tsk);
> >        return 0;
> > @@ -224,6 +241,10 @@ static int fill_stats_for_tgid(pid_t tgid, struct taskstats *stats)
> >         */
> >        rcu_read_lock();
> >        first = find_task_by_vpid(tgid);
> > +       if (first && !ptrace_may_access(first, PTRACE_MODE_READ)) {
> > +               rc = -EACCES;
> > +               goto out;
> > +       }
> >
> >        if (!first || !lock_task_sighand(first, &flags))
> >                goto out;
> 
> Balbir Singh

-- 
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments

  parent reply	other threads:[~2011-06-29 20:17 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-24 12:09 [PATCH 2/2] taskstats: restrict access to user Vasiliy Kulikov
2011-06-29  1:27 ` Balbir Singh
2011-06-29 11:42   ` Vasiliy Kulikov
2011-06-29 20:17   ` Vasiliy Kulikov [this message]
2011-07-02  7:36     ` [kernel-hardening] " Vasiliy Kulikov
2011-07-02  7:36       ` Vasiliy Kulikov
2011-07-04  2:57       ` [kernel-hardening] " Balbir Singh
2011-07-04  2:57         ` Balbir Singh
2011-07-04 17:45         ` [kernel-hardening] " Vasiliy Kulikov
2011-07-04 17:45           ` Vasiliy Kulikov
2011-07-07  8:55           ` [kernel-hardening] " Vasiliy Kulikov
2011-07-07  8:55             ` Vasiliy Kulikov
2011-07-07 11:53             ` [kernel-hardening] " Balbir Singh
2011-07-07 11:53               ` Balbir Singh
2011-07-07 16:23               ` [kernel-hardening] " Vasiliy Kulikov
2011-07-07 16:23                 ` Vasiliy Kulikov
2011-07-09 15:36                 ` [kernel-hardening] " Balbir Singh
2011-07-09 15:36                   ` Balbir Singh
2011-07-11 14:07                   ` [kernel-hardening] " Vasiliy Kulikov
2011-07-11 14:07                     ` Vasiliy Kulikov
2011-06-29 20:09 ` [Security] " Linus Torvalds
2011-06-30  7:57   ` [kernel-hardening] " Vasiliy Kulikov
2011-06-30  7:57     ` Vasiliy Kulikov
2011-06-30 10:59     ` [kernel-hardening] " Balbir Singh
2011-06-30 10:59       ` Balbir Singh
2011-06-30 12:08       ` [kernel-hardening] " Vasiliy Kulikov
2011-06-30 12:08         ` Vasiliy Kulikov
2011-06-30 16:40       ` [kernel-hardening] " Linus Torvalds
2011-06-30 16:40         ` Linus Torvalds
2011-07-01  3:02         ` [kernel-hardening] " Balbir Singh
2011-07-01  3:02           ` Balbir Singh
2011-09-19 16:40           ` [kernel-hardening] " Linus Torvalds
2011-09-19 16:40             ` Linus Torvalds
2011-09-19 17:20             ` [kernel-hardening] " Balbir Singh
2011-09-19 17:20               ` Balbir Singh
2011-09-19 17:39             ` [kernel-hardening] " Vasiliy Kulikov
2011-09-19 17:39               ` Vasiliy Kulikov
2011-09-19 17:45               ` [kernel-hardening] " Linus Torvalds
2011-09-19 17:45                 ` Linus Torvalds
2011-09-20  3:35                 ` [kernel-hardening] " Eric W. Biederman
2011-09-20  3:35                   ` Eric W. Biederman
2011-09-20  5:47                 ` [kernel-hardening] " Alexey Dobriyan
2011-09-20  5:47                   ` Alexey Dobriyan
2011-09-19 17:47               ` [kernel-hardening] " Balbir Singh
2011-09-19 17:47                 ` Balbir Singh
2011-09-19 18:29             ` [kernel-hardening] " Andi Kleen
2011-09-19 18:29               ` Andi Kleen
2011-09-19 18:32               ` [kernel-hardening] " Linus Torvalds
2011-09-19 18:32                 ` Linus Torvalds

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=20110629201718.GA11071@albatros \
    --to=segoon@openwall.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=bsingharora@gmail.com \
    --cc=eparis@redhat.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    --cc=security@kernel.org \
    --cc=solar@openwall.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wilsons@start.ca \
    /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.