I would like to pass a pointer from user space to a function in my kernel module. I do not want to use copy_from_user. I read that I have to use a function get_user_pages.
For example, one page.
struct page **pages;
pages = kmalloc(1 * sizeof(*pages), GFP_KERNEL);
down_read(¤t->mm->mmap_sem);
get_user_pages(current,current->mm,uaddr, 1, 1, 0,pages,NULL);
up_read(¤t->mm->mmap_sem);
uaddr is the address in user space.
- After that, am I allowed to pass and pass a
uaddrkernel module to my function? Or maybe I need to use these in some way struct pages? - Why should I use read / read?
- After all I need to use
SetPageDirty()and page_cache_release()functions?
source
share