I know that copy_to_user
/copy_from_user
, get_user
/put_user
functions are for this purpose.
My question is that, given a user space address/pointer, how can I access the data pointed to by the address from the kernel in general?
I can imagine that first I have to make sure the containing page should be in physical memory (instead of in disk).
What is the next step? Can I use *p
, where p
is the pointer pointing to some user space data, directly to refer to the data?
Or do I have to first invoke kmap
to map the containing physical page frame to the kernel virtual address space? Why?