A Guide For Troubleshooting A Segfault
A Guide For Troubleshooting A Segfault
What is a segfault?
A segmentation fault (also known as a segfault or a segmentation violation) occurs when a
process attempts to access a memory location that it is not allowed to access, or attempts to
access a memory location in a way that is not allowed (for example, attempting to write to a
read-only location, or to overwrite part of the operating system). On Unix family operating
systems, a signal called SIGSEGV - signal #11, defined in the system header file signal.h - is
then sent to to process. The default action for SIGSEGV is abnormal termination: the process
ends and an application core file may be written (depending on the system's configuration).
On some architectures (notably x86_64), the kernel logs a message to the kernel ring buffer
when a segfault is generated.
1. A bug (software defect) in the program or command is encountered, for example a buffer
overflow (an attempt to access memory beyond the end of an array). This can typically be
resolved by applying errata or vendor software updates.
2. A hardware problem affects the virtual memory subsystem. For example, a RAM DIMM or
CPU cache is defective.
If multiple unrelated processes are seen to segfault, then it is likely that a hardware issue is
affecting the virtual memory subsystem. Refer to How to check if system RAM is faulty in Red
Hat Enterprise Linux? for suggestions in this case.
enum x86_pf_error_code {
PF_PROT = 1 << 0,
PF_WRITE = 1 << 1,
PF_USER = 1 << 2,
PF_RSVD = 1 << 3,
PF_INSTR = 1 << 4,
};
01111
^^^^^
||||+---> bit 0
|||+----> bit 1
||+-----> bit 2
|+------> bit 3
+-------> bit 4
What is required for analysis of a segfault ?
For in-depth analysis of a segfault, an application core dump will typically be needed. Refer to
the following articles for guidance on how to capture an application core dump:
How to collect core dump file of a crashing program that is shipped in Red Hat Enterprise
Linux 6 and above ?
How do I enable core file dumps when my application crashes or segmentation faults? (for
older releases)
Analysis requires a debugger program such as gdb. Using these tools is a specialist operation
usually best done by the application developer, and can require the compilation of the
application with extra information contained specifically for the debugger program.
Notes
The kernel message indicating an application segfault was added for the x86_64 architecture in
RHEL5. In RHEL6 it is present for both 32bit and 64bit x86 architectures.
Product(s) Red Hat Enterprise Linux Category Troubleshoot
Why does Oracle Database Client 12.1.0.2 32-bit fail or segfault on RHEL 7?
Solution - Aug 9, 2016
2 Comments
26 November 2013 6:06 PM
AM Angel Madera
COMMUNITY What does this mean to me?How do I prevent this from happening again?
MEMBER
43 Points
≤ Reply
COMMUNITY If the application is provided by a third party, please engage the vendor to begin
MEMBER
troubleshooting the issue and escalate to Red Hat Support if required.
22 Points
≤ Reply