public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: "Richard B. Johnson" <linux-os@analogic.com>
Cc: Hacksaw <hacksaw@hacksaw.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Tomko <tomko@haha.com>,
	Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: Why system call need to copy the date from the userspace before using it
Date: Wed, 13 Apr 2005 14:37:43 -0400	[thread overview]
Message-ID: <20050413183742.GA5252@thunk.org> (raw)
In-Reply-To: <Pine.LNX.4.61.0504130818300.12518@chaos.analogic.com>

On Wed, Apr 13, 2005 at 08:40:05AM -0400, Richard B. Johnson wrote:
> The kernel does NOT have to copy data from user-space before
> using it. 

Incorrect.  It must, or the kernel code in question is by definition
buggy.

> In fact, user-mode pointers are valid in kernel-space
> when the kernel is performing a function on behalf of the user-
> mode code. 

On some architectures, this is true.  But not all architectures, and
not in all circumstances.  For example, even on the x86 architecture,
in the 4G/4G mode, a user-mode pointer is *not* valid when kernel code
is running.  You must use copy_to_user()/copy_from_user().  Simply
dereferencing a user-mode pointer is a BUG.  It might work sometimes,
on some architectures, but not everywhere.  Therefore, for correctly
written kernel code, you must not do it.

						- Ted

  reply	other threads:[~2005-04-13 18:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-13  4:21 Why system call need to copy the date from the userspace before using it Tomko
2005-04-13  5:30 ` Vadim Lobanov
2005-04-13 10:29 ` Jan-Benedict Glaw
2005-04-13 10:43   ` Tomko
2005-04-13 11:10     ` Catalin Marinas
2005-04-14  2:10       ` Tomko
2005-04-14  2:18         ` David Schwartz
2005-04-14 14:05         ` Helge Hafting
2005-04-13 11:33 ` Benjamin Herrenschmidt
2005-04-13 11:59   ` Hacksaw
2005-04-13 12:40     ` Richard B. Johnson
2005-04-13 18:37       ` Theodore Ts'o [this message]
2005-04-13 19:20         ` Richard B. Johnson
2005-04-16  4:50           ` Hacksaw
2005-04-16  5:18             ` Vadim Lobanov
2005-04-16  8:30               ` Hacksaw
2005-04-16 19:35                 ` Vadim Lobanov
2005-04-16 23:46             ` David Wagner
  -- strict thread matches above, loose matches on Subject: below --
2005-04-13  6:48 Vadim Lobanov

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=20050413183742.GA5252@thunk.org \
    --to=tytso@mit.edu \
    --cc=benh@kernel.crashing.org \
    --cc=hacksaw@hacksaw.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-os@analogic.com \
    --cc=tomko@haha.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