Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6503

"page_address()" returned void pointer with memcpy causing system freez -- the memcpy obj in turned getting shared with user space

$
0
0

I am trying to copy kernel page type object to another object of type void pointer using memcpy. I am using page_address() function call which returns void pointer

I think the system freeze issue happening because when I copy void *val=page_address(page) to another void pointer with allocated space with memcpy. I like to know Is there anything wrong with the below code.

     if(index==0){        if(n==NULL){            n=(struct Node *) kmalloc(65536,GFP_USER);        }        memcpy(n->data,val,sizeof(val));        index=0;        return n;        }

Considering val is returned from page_address as a kernel page. Can I access this with user space. I think in Embedded development there are applications that does this sort of work likeI am sharing data object with user space using character driver's read. n parameter is been allocated with space much larger or equal to val size. page size of my system is 4096 bytes x 8=32,192 bits and I have tested with much more space for n->data like 64k bits


Viewing all articles
Browse latest Browse all 6503

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>