I want to share memory between two process.
After mmap()
, I get a address mapStart
, then I add offset to mapStart
and get mapAddr
, and make sure mapAddr
will not exceed maped PAGE_SIZE.
When I write to mapAddr
by
memcpy((void *)mapAddr, data, size);
everything is OK.
But when I read from mapAddr
by
memcpy( &data, (void *)mapAddr, size);`
that will case system crash.
Who know Why?
The similar problem is here
Add some Info: @Tony Delroy, @J-16 SDiZ
mmap function is:
mapStart = (void volatile *)mmap(0, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_LOCKED, memfd, pa_base);
system crash: have no any OS error message, Console print some MCA
info
the detail described in here