lkml.org 
[lkml]   [2005]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Why system call need to copy the date from the userspace before using it
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-04-13 20:45    [W:0.054 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site