memory - Accessing the vm areas of a process -


i trying write lkm have read vm areas address process. using pid_task() pointer task_struct, getting compiling error when try use start address of vmarea.

struct task_struct *ts; ts = pid_task(find_vpid(pid_t)pid,pidtype_pid); printk(kern_info "%lu",ts->mm->mmap->start); 

and getting error "error: dereferencing pointer incomplete type"

i linux noob , noob in lkm.

i'd appreciate help.

thank

i have test on kernel source tree(2.6.35) following codes, compilation okey:

struct task_struct *ts; pid_t pid;  ts = pid_task(find_vpid(pid),pidtype_pid); printk(kern_info "%lu",ts->mm->mmap->vm_start); 

could try above codes in kernel source tree? think maybe have include header files needed, such as:

#include <asm/uaccess.h> #include <linux/errno.h> #include <linux/time.h> #include <linux/proc_fs.h> #include <linux/stat.h> #include <linux/init.h> #include <linux/capability.h> #include <linux/file.h> #include <linux/fdtable.h> #include <linux/string.h> #include <linux/namei.h> #include <linux/mnt_namespace.h> #include <linux/mm.h> #include <linux/swap.h> #include <linux/rcupdate.h> #include <linux/kallsyms.h> #include <linux/stacktrace.h> #include <linux/resource.h> #include <linux/module.h> #include <linux/mount.h> #include <linux/security.h> #include <linux/ptrace.h> #include <linux/tracehook.h> #include <linux/cgroup.h> #include <linux/cpuset.h> #include <linux/audit.h> #include <linux/poll.h> #include <linux/nsproxy.h> #include <linux/oom.h> #include <linux/elf.h> #include <linux/pid_namespace.h> #include <linux/fs_struct.h> 

another:

after compilation successfully, should judge pointers null or not.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -