Re: page locking from application

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

 



On Mon, 2006-07-24 at 05:14 -0400, Mark Hounschell wrote:
> Thomas Petazzoni wrote:
> > Hi,
> > 
> > Le Fri, 21 Jul 2006 09:10:47 -0400,
> > Mark Hounschell <markh@xxxxxxxxxx> a écrit :
> > 
> >>> Use copy_from_user() in the kernel. It will automagically fetch the
> >>> page from swap or from anywhere it is.
> >> Wouldn't mlockall used in the application do it?
> > 
> > It would do it, but that's completely useless to mlock() an entire
> > application just for this reason.
> > 
> > copy_from_user() and copy_to_user() are specifically designed to handle
> > page faults that may occur during the copy.

they do more though: they recognize that the kernel and userspace may
run in a separate address space and they bridge that. To underline that:
even if you mlock() the memory, you still cannot dereference userspace
pointers in the kernel, you STILL *have* to use copy_*_user() api set
(includes get_user/put_user etc)



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