I would like to be able to tell which pages in the page table belonging to a process are used as data segment.
I am using Linux kernel v 3.2 for amd64
here is what I did before and did not work:
-
accessing the data segment using
task->mm->start_data(task is the task_struct for the target process). -
searching through
task->mm->mmap(linked list) and compare the start address of eachvm_area_struct(vm_start) with thetask->mm->start_data. Here I a assuming that the start of the data segment is aligned with the beginning of a page.
all this should be done within a kernel module.
Thanks.
after some research looks like passing task->mm->start_data to get_user_pages combined with kmap would do the trick.