copy_from_user user space address mapping in the kernel page table.

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Sun Nov 2 20:15:03 EST 2014


On Sun, 02 Nov 2014 19:57:44 +0530, mind entropy said:
>   In the copy_from_user when the user passes the virtual address is
> the address mapped in the kernel page tables?

Actually, a large part of the reason for copy_from_user()'s existence is
to deal with the possibility that the page is *not* mapped at the moment
because it's been swapped out (at which point we need to schedule a read
operation for whatever backing store the page had (filesystem, swap, or
zero-page for a never-before-referenced page), wait for it to arrive,
and then nail it down so it doesn't leave out from under us before
we finish the copy from the page.

And of course, it's even *more* fun when the copy crosses a page boundary,
and one or both of the pages isn't resident....

>                                                In the function there is
> a source is a user virtual address(<3GB) and the destination is the

Only for 32-bit kernels.  x86_64 has a different memory layout.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20141102/566f59db/attachment.bin 


More information about the Kernelnewbies mailing list