Per siginfo.h :
SEGV_MAPERR means that you tried to access an address that does not map to anything.
SEGV_ACCERR means that you tried to access an address that you do not have access to.
Thus, in both cases, you gained access to an address that you should not have, which is probably the only culprit in your actual code. In the first case, there is no memory in this address range. In the latter case, there is memory in this address range, but you do not own it.
If you need to access a random address that you get depends on how the OS will have your process at the moment.
Tommy
source share