mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: sk b <skb300@hotmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: user pointers and race conditions
Date: Thu, 17 May 2007 06:04:36 +0100	[thread overview]
Message-ID: <20070517050436.GN4095@ftp.linux.org.uk> (raw)
In-Reply-To: <BAY115-W33D3EC723171255D88FBF86330@phx.gbl>

On Wed, May 16, 2007 at 10:56:22PM -0600, sk b wrote:
> 
> Hello,
> 
> I'm wondering whether there is an exploitable TOCTTOU race condition in the way user pointers are handled in the kernel. Consider the following code:
> 
> 1: struct st { int *u; };
> 2: void syscall(struct st * stp) {
> 3:        if (!access_ok(VERIFY_READ,stp,sizeof(struct st)))
> 4:                return;
> 5:        if (!access_ok(VERIFY_WRITE,stp->u,sizeof(int)))

... and there's your bug - direct access to userland data.  The normal
variant is to use accessors (get_user() or copy_from_user()) to fetch
the value of stp->u.  At which point races of the kind you mentioned
take an obviously dumb code (explicitly copying the same struct from
userland _twice_).


  reply	other threads:[~2007-05-17  5:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-17  4:56 sk b
2007-05-17  5:04 ` Al Viro [this message]
2007-05-17  5:06 ` David Miller
2007-05-17 12:26 ` Arjan van de Ven

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=20070517050436.GN4095@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=skb300@hotmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®