🇰🇷 한글 설명
Linux 커널의 regulator 코어에서 regulator_lock_two() 함수가 데드락 발생 시 반환되는 에러 코드를 잘못 검사하는 취약점입니다. MIPS 아키텍처에서 -EDEADLK 대신 -EDEADLOCK을 사용하여 데드락 감지 시 적절한 후속 조치를 취하지 못하고 리소스를 불완전하게 잠그는 문제가 발생합니다.
💡 쉬운 설명
컴퓨터가 두 가지 자원을 동시에 사용하려 할 때 충돌이 나면 안전하게 순서를 바꿔야 하는데, 특정 환경에서 이 규칙을 잘못 인식하는 오류입니다. 이로 인해 시스템이 자원을 제대로 관리하지 못하고 오류를 일으킬 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
regulator: core: regulator_lock_two() should test for EDEADLK not EDEADLOCK
Compare against -EDEADLK, which is what ww_mutex_lock() actually
returns and what every other deadlock check in this file already uses.
Function regulator_lock_two() acquires two regulators via
regulator_lock_nested() -> ww_mutex_lock(). On contention,
ww_mutex_lock() returns -EDEADLK, which is the caller's signal to drop
the lock it holds and retry the acquisition in the canonical order.
However, regulator_lock_two() tests the return value against -EDEADLOCK
rather than -EDEADLK. On most architectures, EDEADLK and EDEADLOCK are
the same value, so the comparison happens to be correct and the bug is
invisible. But on MIPS, SPARC, and PowerPC, those two errors have
different values. The test is wrong: a genuine -EDEADLK backoff no
longer matches -EDEADLOCK, so instead of unlocking and retrying, the
code falls into WARN_ON(ret) and returns with only one of the two
regulators locked.
In practice, this is a bug only on MIPS, because the regulator core is
not built or used on the other two platforms.
In general, EDEADLK is preferred over EDEADLOCK for new code.
📍 영향받는 시스템
MIPS 아키텍처를 사용하는 Linux 커널 시스템
⚔️ 공격 벡터
직접적인 외부 공격보다는 특정 하드웨어 자원 사용 패턴을 통한 시스템 불안정 유발
🛡️ 대응 방법
regulator_lock_two() 함수 내의 에러 코드 검사 로직을 -EDEADLOCK에서 -EDEADLK로 수정된 최신 커널로 업데이트
🔧 검증 코드
명령어 결과에 mips가 포함되어 있고, 현재 사용 중인 커널 버전이 해당 패치가 적용된 버전인지 확인합니다.
uname -m | grep -i mips && uname -a