I'm trying to read the values from memory of a process according to their vma's. However, whenever I try to access these locations en masse the system hangs and then crashes.
void print_mmap(struct vm_area_struct *mmap){ while (mmap != NULL) { printk(KERN_INFO "vm_start: %lu vm_end: %lu difference: %lu\n", mmap->vm_start, mmap->vm_end, (mmap->vm_end-mmap->vm_start)); int i; for (i=0;mmap->vm_start<mmap->vm_end;i++) { (unsigned long*) (mmap->vm_start+i); } mmap = mmap->vm_next; }}
Why would this happen? I use rcu_read_lock() and task_lock() prior to calling the function. If I print just one value or a few values from memory then the driver runs just fine, it appears to hang only when I access from beginning to end. Is there a better way of doing this?