Re: syscall help

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

 



Athul Acharya wrote:
Hey folks,

How do I (in a syscall) check that an address passed to me is in the
user's address space?

Athul

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


You can get the differents memory regions of the process by the following fields :
current->mmap, current->mmap_avl and current->mmap_cache. These fields are struct vm_area_struct type.


struct vm_area_struct{
	unsigned long vm_start ;
	unsigned long vm_end ;
	....
};

So you cab check every region of the current process and see if the adress passed exists in memory space of the process.

But are you sure you need to do this test ?
try to use the functions get_users and verify the data after. Should be better.




--
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