What is SEGV_MAPERR?

LinuxPosixSegmentation FaultCoredump

Linux Problem Overview


What is SEGV_MAPERR, why does it always come up with SIGSEGV?

Linux Solutions


Solution 1 - Linux

There are two common kinds of SEGV, which is an error that results from an invalid memory access:

  1. A page was accessed which had the wrong permissions. E.g., it was read-only but your code tried to write to it. This will be reported as SEGV_ACCERR.
  2. A page was accessed that is not even mapped into the address space of the application at all. This will often result from dereferencing a null pointer or a pointer that was corrupted with a small integer value. This is reported as SEGV_MAPERR.

Documentation of a sort (indexed Linux source code) for SEGV_MAPERR is here: <http://lxr.free-electrons.com/ident?i=SEGV_MAPERR>;.

Solution 2 - Linux

It's a segmentation fault. Most probably a dangling pointer issue, or some sort of buffer overflow.

SIGSSEGV is the signal that terminates it based on the issue, segmentation fault.

Check for dangling pointers as well as the overflow issue.

Enabling core dumps will help you determine the problem.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGeekView Question on Stackoverflow
Solution 1 - LinuxahcoxView Answer on Stackoverflow
Solution 2 - LinuxSevView Answer on Stackoverflow