How to get a page from a userspace process for a given task in Linux?
What exactly does the virt_to_page function return, does it return the page given an address in the kernel space or does it return a page given an address in user space? As far as I can tell it seems that it takes a kernel address and returns the page for that. If so what can I use to get a page from a user space process 开发者_如何学JAVAgiven the task or mm_struct and then virtual address?
virt_to_page()
does indeed work only for direct-mapped kernel addresses. To find a page for a userspace mapping, you need to use get_user_pages()
(and do a put_page
when you're done to release the reference on the page).
精彩评论