DB / Linux / 11
CRITICAL
Linux SIGSEGV (Segmentation Violation)
SIGSEGV (Signal 11) indicates a segmentation fault where a program attempts to access memory it doesn't have permission to access, typically causing immediate termination.
Common Causes
- Dereferencing a null or invalid pointer
- Accessing memory beyond allocated bounds (buffer overflow)
- Writing to read-only memory
- Stack overflow or corruption
- Using freed or uninitialized memory
How to Fix
1 Debug with GDB
Use GNU Debugger to get a backtrace and identify the exact line causing the fault.
BASH
$ gdb ./your_program
run
# After crash:
bt
where 2 Enable Core Dumps
Configure system to generate core dump files for post-mortem analysis.
BASH
$ ulimit -c unlimited
echo "/tmp/core.%e.%p" > /proc/sys/kernel/core_pattern 3 Use Address Sanitizer
Compile with ASAN to detect memory errors during runtime.
BASH
$ gcc -fsanitize=address -g -o program program.c
./program 4 Check System Logs
Examine kernel logs for additional context about the segmentation fault.
BASH
$ dmesg | tail -20
journalctl -xe | grep -i segfault