A linked list of structures in kernel mode

Could you tell me, please, how may I create a linked list of structures in kernel mode? If I use malloc(9) I get address in heap (0xff), but I can't get it from userland.

Code:
(gdb) p kshmptr->u.shm_pi
$1 = (struct shmid_pi *) 0xfffffe0019cd3800
(gdb) p kshmptr->u.shm_pi->shm_pid
Error accessing memory address 0xfffffe0019cd3800: Address is not correct.
 
fonz said:
In kernel space one is supposed to use queue(3) instead of rolling one's own.

Thanks for your reply! I requested the parent structure via kvm_read(3), but this function copies elements to my pointer. If I get a pointer to LIST_HEAD(3), kvm_read(3) copies its address to my pointer. But the original address pointer to LIST_HEAD(3) is not correct for my address space:( Tell me please, how can I get values of a structure (not address)?
 
Back
Top