Messages in this thread | | | Date | Wed, 13 Apr 2005 14:37:43 -0400 | From | Theodore Ts'o <> | Subject | Re: 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/
| |