🇰🇷 한글 설명
Linux 커널의 kexec 실행 중 KCOV 커버리지 계측이 GS base 무효화로 인해 무한 루프 크래시를 유발합니다. CONFIG_KCOV와 CONFIG_KEXEC이 동시에 활성화된 64비트 시스템에서만 발생하며, 기계 검증(syzkaller) 환경에서 주로 문제가 됩니다.
💡 쉬운 설명
Linux 커널이 새로운 커널로 부팅할 때(kexec 사용), 코드 품질 검사 도구(KCOV)가 혼동되어 무한 루프에 빠집니다. 로컬 사용자가 이 명령을 실행할 수 있으면 시스템을 다운시킬 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
x86/kexec: Disable KCOV instrumentation after load_segments()
The load_segments() function changes segment registers, invalidating GS base
(which KCOV relies on for per-cpu data). When CONFIG_KCOV is enabled, any
subsequent instrumented C code call (e.g. native_gdt_invalidate()) begins
crashing the kernel in an endless loop.
To reproduce the problem, it's sufficient to do kexec on a KCOV-instrumented
kernel:
$ kexec -l /boot/otherKernel
$ kexec -e
The real-world context for this problem is enabling crash dump collection in
syzkaller. For this, the tool loads a panic kernel before fuzzing and then
calls makedumpfile after the panic. This workflow requires both CONFIG_KEXEC
and CONFIG_KCOV to be enabled simultaneously.
Adding safeguards directly to the KCOV fast-path (__sanitizer_cov_trace_pc())
is also undesirable as it would introduce an extra performance overhead.
Disabling instrumentation for the individual functions would be too fragile,
so disable KCOV instrumentation for the entire machine_kexec_64.c and
physaddr.c. If coverage-guided fuzzing ever needs these components in the
future, other approaches should be considered.
The problem is not relevant for 32 bit kernels as CONFIG_KCOV is not supported
there.
[ bp: Space out comment for better readability. ]
📍 영향받는 시스템
CONFIG_KCOV와 CONFIG_KEXEC이 모두 활성화된 64비트 Linux 커널 (x86_64, fuzzing/crash dump 수집 설정)
⚔️ 공격 벡터
로컬 공격자가 kexec 실행 권한 있을 시 'kexec -e' 명령으로 커널 DoS 트리거
🛡️ 대응 방법
커널 업데이트: machine_kexec_64.c와 physaddr.c 파일에 KCOV instrumentation 비활성화 패치 적용
🔧 검증 코드
두 설정이 모두 'y'로 활성화되면 영향 대상, 하나라도 'n'이거나 없으면 안전
grep -E '^CONFIG_KCOV|^CONFIG_KEXEC' /boot/config-$(uname -r)