I'm trying to loop over vma's (referenced by the pointer mm) inside of the task_struct. What I'm doing is trying to print some of the attributes of the struct vm_area_struct (specifically, I'm trying to print vm_start). My issue is that I keep getting a NULL pointer dereference error.
void print_mmap(struct vm_area_struct *mmap){ while(mmap->vm_next != NULL) { printk(KERN_INFO "vm_start: %lu\n", mmap->vm_start); mmap = mmap->vm_next; }}
The error I get is
[ 177.348231] BUG: kernel NULL pointer dereference, address: 0000000000000010[ 177.348235] #PF: supervisor read access in kernel mode[ 177.348237] #PF: error_code(0x0000) - not-present page
Can anyone help me loop until I reach the end of this linked list without throwing an error?