Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
243 views
in Technique[技术] by (71.8m points)

c - Trying to access the memory of a non-kernel process via task_struct

Currently I've written the following short code segment:

 struct task_struct *task_list;
 struct mm_struct *mm = task_list->mm;

My goal is to take a snapshot of the process during runtime (or while its state is waiting - whichever is easier).

Process Address Soace Structures

Above I have included a graph of what mm_struct holds and I guess what I'm having trouble with is actually figuring out where the "vm_end" and "vm_start" sections of the struct are and if they actually contain the start/stop address I need in order to copy the memory of a process. Because vm_start and vm_end are a part of a struct called vm_region, not mm_struct. So, how do I take these values which are the beginning and ends of a memory region and how do I actually reference them in memory?

Would I need to access struct vm_area_struct *mmap? Since it is a list of VMA's?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...