Re: need type to carry kernel pointers to user space

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Wed Jan 19 2000 - 15:50:09 EST


On Wed, 19 Jan 2000 almesber@lrc.di.epfl.ch wrote:

> Recently, we had a discussion on the linux-atm list about the best approach
> for passing kernel pointers to user space, and back. The idea is as follows:
[SNIPPED...]

A pointer in user space is not a pointer in kernel space! Kernel data
is referenced by a discriptor, referenced as KERNEL_DS, which is not
accessible from user-mode privilege.

You can use mmap() to map kernel data (if you know where it is) to
user-space. However, modification from user-mode code will give
problems with atomicity.

If you need to access to kernel data, you should use an installable
module. Here, the mapping to KERNEL_DS is done for you, and you
can copy_from_user(), copy_to_user(), with the required translation
and, paging done for you. Typical copy using read() from a device
driver runs at between 300 to 750 megabytes per second, depending
upon the CPU, speed, and cache characteristics.

Cheers,
Dick Johnson

Penguin : Linux version 2.3.39 on an i686 machine (800.63 BogoMips).

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jan 23 2000 - 21:00:20 EST