🇰🇷 한글 설명
Linux 커널의 RISC-V 아키텍처에서 sbi_ecall.c 함수를 ftrace로 추적할 때 데드락(교착 상태)이 발생하는 취약점입니다. 스냅샷 생성 과정에서 발생하는 IPI 인터럽트가 다시 sbi_ecall을 호출하여 무한 루프에 빠지게 됩니다. 이 문제는 sbi_ecall.c 함수들을 추적 대상에서 제외함으로써 해결되었습니다.
💡 쉬운 설명
컴퓨터의 동작을 기록하는 기능을 켰을 때, 기록하는 과정 자체가 다시 기록을 요청하면서 시스템이 무한 반복에 빠져 멈춰버리는 문제입니다. 특정 하드웨어 설정에서 이 현상이 쉽게 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
riscv: trace: fix snapshot deadlock with sbi ecall
If sbi_ecall.c's functions are traceable,
echo "__sbi_ecall:snapshot" > /sys/kernel/tracing/set_ftrace_filter
may get the kernel into a deadlock.
(Functions in sbi_ecall.c are excluded from tracing if
CONFIG_RISCV_ALTERNATIVE_EARLY is set.)
__sbi_ecall triggers a snapshot of the ringbuffer. The snapshot code
raises an IPI interrupt, which results in another call to __sbi_ecall
and another snapshot...
All it takes to get into this endless loop is one initial __sbi_ecall.
On RISC-V systems without SSTC extension, the clock events in
timer-riscv.c issue periodic sbi ecalls, making the problem easy to
trigger.
Always exclude the sbi_ecall.c functions from tracing to fix the
potential deadlock.
sbi ecalls can easiliy be logged via trace events, excluding ecall
functions from function tracing is not a big limitation.
📍 영향받는 시스템
CONFIG_RISCV_ALTERNATIVE_EARLY가 설정된 RISC-V 기반 Linux 커널 시스템
⚔️ 공격 벡터
로컬 사용자가 ftrace 필터 설정을 통해 특정 커널 함수를 추적하도록 명령을 실행할 경우 발생
🛡️ 대응 방법
커널 업데이트를 통해 sbi_ecall.c 함수가 ftrace 추적에서 제외되도록 패치 적용
🔧 검증 코드
출력 결과에 riscv가 포함되어 있는지 확인하여 해당 아키텍처 사용 여부를 판단합니다.