سؤال

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:

  1. accessing the data segment using task->mm->start_data (task is the task_struct for the target process).

  2. searching through task->mm->mmap (linked list) and compare the start address of each vm_area_struct (vm_start) with the task->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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top