Re: Verify Kernel Pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 20, 2006 at 06:11:41PM +0000, Talib Alim wrote:
> My module pass back pointer to user application when device is opened. From that point, user application request different services from my module.
> 
> In order to avoid any lookup overhead, kernel virtual pointer is passed back to user application.
> 
> Talib
> 
> >On 4/20/06, Talib Alim <talibalm@xxxxxxxxxxx> wrote:
> >> A kernel virtual address is passed to my module. In order to avoid any
> >> chances of a crash, how can I verify  this pointer is pointing to a mapped
> >> memory location.
> >
> >Can you elaborate more on this ?

Hi,

I don't know if I have understood : you want to implement a service in
ther kernel and then call it from user space ?

If you want to do that you have 2 main solutions :
	_ through system call (you should avoid it, it's recommended
	to add new system calls)
	_ through a 'device driver'

You should use the second solution.
Traditionnaly, a device driver provides :
    _ a read operation
    _ a write operation
    _ a seek operation
    _ ...
    _ ioctl
You can then write, read , call other operations of the device.
Here is a good link to learn more about device drivers :
http://lwn.net/Kernel/LDD3/

But you can't use your solution : a kernel pointer is not valid in user
mode. You should read some doc on the virtual memory management and
paging in Linux : 
http://www.phptr.com/content/images/0131453483/downloads/gorman_book.pdf

-- 
tyler
tyler@xxxxxxxx


	

	
		
___________________________________________________________________________ 
Faites de Yahoo! votre page d'accueil sur le web pour retrouver directement vos services préférés : vérifiez vos nouveaux mails, lancez vos recherches et suivez l'actualité en temps réel. 
Rendez-vous sur http://fr.yahoo.com/set


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux