기술 · 실용 가이드
Linux “Segmentation fault (core dumped)”? 재설치 전에 crash와 binary를 일치시키세요
한 번의 crash 기록을 고정하고 실제 core handler를 찾아 dump를 보존한 뒤 executable과 library 일치를 증명하고 모든 thread를 분석합니다.

“Core dumped”가 current directory에 core라는 file이 있다는 뜻은 아닙니다. Linux는 dump를 억제하거나 이름을 바꾸고 handler로 pipe하거나 systemd-coredump가 다른 위치에 보존할 수 있습니다. package 변경, 반복 restart, rebuild 전에 event를 보존합니다.
유효한 postmortem에는 보존한 core, crash한 정확한 executable bytes, mapped library와 올바른 symbol이 한 묶음으로 맞아야 합니다. top frame은 실행이 멈춘 지점일 뿐 memory가 처음 손상된 위치라고 단정할 수 없습니다.
1. system이 바뀌기 전에 한 crash를 고정
UTC 시간, command/service, PID, signal, workload, 첫 관련 log와 service status를 보존해 이후 artifact를 한 event에 연결합니다.
reinstall, strip, upgrade 또는 executable 교체를 미룹니다. 복구가 필요하면 binary와 library를 먼저 copy/hash하고 package 또는 container digest를 기록합니다.
2. 실제 core route 확인
crash context의 `ulimit -c`와 `/proc/sys/kernel/core_pattern`을 읽습니다. `|`로 시작하는 값은 pathname이 아니라 handler입니다. systemd라면 `coredumpctl list`와 `info`로 시간, PID, executable을 맞춥니다.
`coredumpctl dump PID --output=core.PID`로 dump를 export하거나 원래 file을 보존하고 handler metadata, 시간, signal, retention을 기록합니다. dump가 없으면 제한 branch를 적고 postmortem을 꾸미지 않습니다.
3. core를 정확한 binary bytes에 연결
crash executable을 hash하고 `readelf -n`으로 ELF Build ID를 기록합니다. package metadata, container digest와 mapped library도 보존합니다. 같은 release 이름만으로 address 일치를 증명할 수 없습니다.
`gdb -q /exact/program core.PID`로 명시적으로 엽니다. executable, shared library 또는 symbol mismatch 경고는 evidence-integrity failure입니다. 일치하는 artifact를 회수하지 못하면 멈춥니다.
4. frame zero만 보지 말고 모든 thread 분석
`info files`, `info sharedlibrary`, `thread apply all bt full`, register와 정지 명령 주변 disassembly를 raw transcript로 보존하고 symbol 상태를 기록합니다.
SIGSEGV는 앞선 out-of-bounds write, use-after-free 또는 race 결과일 수 있습니다. top frame은 정지점입니다. thread, input, ownership와 reproduction으로 가설을 세우고 안전하면 격리 환경의 debug build나 sanitizer로 검증합니다.
5. 한 가설만 고치고 acceptance 정의
증거에 연결된 검토 가능한 변경 하나를 수행하고 원본 core, hash와 transcript는 변경하지 않습니다.
같은 workload와 environment를 replay합니다. 예상 출력, 새 동일 core 없음, 안정된 health, deployed Build ID 기록이 acceptance입니다. 단순 restart는 증명이 아닙니다.
