public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: daw@cs.berkeley.edu (David Wagner)
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] getrusage sucks
Date: Fri, 11 Nov 2005 23:41:15 +0000 (UTC)	[thread overview]
Message-ID: <dl3a6r$ikf$1@taverner.CS.Berkeley.EDU> (raw)
In-Reply-To: 200511112338.20684.cloud.of.andor@gmail.com

Claudio Scordino  wrote:
>So, is the following patch right ? I've added both the lock and the owner 
>check...

I think this patch is too permissive.  It lets me run a setuid-root
program and then call getrusage() on it.  That's not a good idea.
(I might, say, run /bin/su and then mount a timing or cache side-channel
attacks on its password hashing code.  That particular example might or
might not work, but I hope it illustrates my concern.)

Should you be using the same permission check that ptrace() does?
ptrace() is more restrictive than what you seemed to have in mind.
However, if ptrace() lets you attach to a process, then it's probably
pretty safe to let you call getrusage(), as you could have just used
ptrace() to read the process's entire memory image.

kernel/ptrace.c:ptrace_may_attach() might be relevant.

TOCTTOU vulnerabilities could be a problem.  If I understand correctly,
your locking code should take care of this, but you might want to
double-check, as I'm not very familiar with the kernel's locking scheme.

  parent reply	other threads:[~2005-11-11 23:41 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-10 23:47 [PATCH] getrusage sucks Hua Zhong (hzhong)
2005-11-11  0:23 ` Claudio Scordino
2005-11-11  0:32   ` Magnus Naeslund(f)
2005-11-11  1:11     ` Claudio Scordino
2005-11-11 13:30       ` Alan Cox
2005-11-11 22:38         ` Claudio Scordino
2005-11-11 23:23           ` Alan Cox
2005-11-11 23:02             ` Chris Wright
2005-11-11 23:44               ` David Wagner
2005-11-12  0:53                 ` Chris Wright
2005-11-12  6:37                   ` David Wagner
2005-11-11 23:58               ` Alan Cox
2005-11-11 23:43                 ` Claudio Scordino
2005-11-11 23:49                   ` dean gaudet
2005-11-12  1:10                     ` Chris Wright
2005-11-12 15:10                       ` making makefile for 2.6 kernel anil dahiya
2005-11-12 15:16                       ` anil dahiya
2005-11-12 22:19                         ` Sam Ravnborg
2005-11-13  1:34                       ` [PATCH] getrusage sucks Claudio Scordino
2005-11-15 16:56                       ` Claudio Scordino
2005-11-15 17:00                       ` New getrusage Claudio Scordino
2005-11-11 23:08             ` [PATCH] getrusage sucks Claudio Scordino
2005-11-11 23:41           ` David Wagner [this message]
2005-11-15  1:08       ` Peter Chubb
  -- strict thread matches above, loose matches on Subject: below --
2005-11-15 18:25 linux
2005-11-11 23:49 Hua Zhong (hzhong)
2005-11-10 22:34 Claudio Scordino
2005-11-11  5:06 ` David Wagner
2005-11-11 19:09   ` Lee Revell
2005-11-11 19:13     ` David Wagner

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='dl3a6r$ikf$1@taverner.CS.Berkeley.EDU' \
    --to=daw@cs.berkeley.edu \
    --cc=daw-usenet@taverner.CS.Berkeley.EDU \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox