Skip to contentSkip to conversation

Is this normal or wrong?

DISCUSSION ishare 2 participants 3 messages Mar 7, 2013 – Mar 13, 2013

lore
Share & tools
lore

ishare

author
#0 lore raw

In init procedure ,I use kmem_cache_alloc to apply for memory to locate a inode struct. it returns to me a inode whose i_dentry element cantain a struct list_head pointing to address 0x3, Is the address within low momery resonable or illegal?

thanks!

#1 lore raw

kmem_cache_alloc() is used to allocate a memory object from a respective cache.
Can you elaborate on what is ur objective or can you get us how you have invoked this function.

To my understanding kmem_cache_alloc() will just return a linear virtual address (void *) of a memory object.
It would not initialize this memory. What you are seeing is a stale value which is unwarranted in this context.

Signature · 4 lines
Regards,
Prabhunath G
Linux Trainer
Bangalore
Quoted 7 lines · ishare

In init procedure ,I use kmem_cache_alloc to apply for memory to locate
a inode struct.
it returns to me a inode whose i_dentry element cantain a struct
list_head pointing to address 0x3,
Is the address within low momery resonable or illegal?

Quoted 7 lines

thanks!

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130312/79d770d9/attachment.html

author
#2 lore raw
Quoted 8 lines · Prabhu nath

kmem_cache_alloc() is used to allocate a memory object from a respective cache.
Can you elaborate on what is ur objective or can you get us how you have invoked this function.

To my understanding kmem_cache_alloc() will just return a linear virtual address (void *) of a memory object.

yes, it returns to me a struct inode * , whose valuse is reasonable , the value of its member struct list_head i_dentry is {0x1,0x3 },their structures is as below :

struct inode

 {
       struct hlist_node	i_hash;
       struct list_head		i_list;
       struct list_head		i_dentry;
       unsigned long		i_ino; 

....

}

struct list_head

 {
     struct list_head *next, *prev;

};

After locate memory from cache , the i_dentry's **next** member, whose valuse is 0x1 , will be used to linked with another list_head , in this procedure there is a addressing instruction to 0x1,but this time the low memory region has been zaped by setting pde at 0x0 to zero , so this addressing causes a page_fault, then goto reboot .

how to resolve this ?

Quoted 24 lines
Signature · 5 lines
-- 
Regards,
Prabhunath G
Linux Trainer
Bangalore
Quoted 14 lines · ishare

In init procedure ,I use kmem_cache_alloc to apply for memory to locate
a inode struct.
it returns to me a inode whose i_dentry element cantain a struct
list_head pointing to address 0x3,
Is the address within low momery resonable or illegal?

thanks!

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies