Android Kernel: Accessing mm_struct members in module leads to restart
Hello,
I have been working on a loadable kernel module for a rooted android device which requires me to access mm_struct members.
I was using the following code to access the data in the read function:
struct task_struct* task;
struct mm_struct* test_mm;
int len;
for_each_process{
task_lock(task);
test_mm = task->mm;
len = test_mm->arg_end - test_mm->arg_start;
/* some code*/
task_unlock(task);
}
Compiling and loading does not lead to an error. However, on doing a cat /dev/my_device, the device restarts and I lose root access. I tired this iteratively by accessing just mm->arg_start and a few other mm_struct members but it still led to a restart.
My kernel version is 3.1.10 on running on Jellybean
I was wondering if there are any restrictions on accessing certain sections of the mm_struct for each process.
Since this is my first post in this forum, moderators please let me know if I should post this query someplace else.
Thanks for your help in advance.
|