🇰🇷 한글 설명
Linux 커널의 dm-thin 구성 요소에서 RCU(Read-Copy-Update) 메커니즘을 사용하는 과정 중 레이스 컨디션 취약점이 발견되었습니다. 리스트가 비어있는지 확인하는 시점과 첫 번째 요소를 가져오는 시점 사이의 불일치로 인해 잘못된 메모리 참조가 발생하여 시스템 크래시(GP fault)를 유발할 수 있습니다.
💡 쉬운 설명
데이터를 읽는 도중에 다른 작업이 데이터를 삭제하면, 컴퓨터가 존재하지 않는 데이터를 참조하려다 갑자기 멈추거나 오류가 발생하는 문제입니다. 이로 인해 시스템이 예기치 않게 종료될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
dm thin: make get_first_thin use rcu-safe list first function
The documentation in rculist.h explains the absence of list_empty_rcu()
and cautions programmers against relying on a list_empty() ->
list_first() sequence in RCU safe code. This is because each of these
functions performs its own READ_ONCE() of the list head. This can lead
to a situation where the list_empty() sees a valid list entry, but the
subsequent list_first() sees a different view of list head state after a
modification.
In the case of dm-thin, this author had a production box crash from a GP
fault in the process_deferred_bios path. This function saw a valid list
head in get_first_thin() but when it subsequently dereferenced that and
turned it into a thin_c, it got the inside of the struct pool, since the
list was now empty and referring to itself. The kernel on which this
occurred printed both a warning about a refcount_t being saturated, and
a UBSAN error for an out-of-bounds cpuid access in the queued spinlock,
prior to the fault itself. When the resulting kdump was examined, it
was possible to see another thread patiently waiting in thin_dtr's
synchronize_rcu.
The thin_dtr call managed to pull the thin_c out of the active thins
list (and have it be the last entry in the active_thins list) at just
the wrong moment which lead to this crash.
Fortunately, the fix here is straight forward. Switch get_first_thin()
function to use list_first_or_null_rcu() which performs just a single
READ_ONCE() and returns NULL if the list is already empty.
This was run against the devicemapper test suite's thin-provisioning
suites for delete and suspend and no regressions were observed.
📍 영향받는 시스템
Linux Kernel (dm-thin 모듈을 사용하는 시스템)
⚔️ 공격 벡터
로컬 시스템에서 특정 I/O 작업(thin-provisioning 관련)을 유도하여 커널 레이스 컨디션 유발
🛡️ 대응 방법
dm-thin의 get_first_thin() 함수가 list_first_or_null_rcu()를 사용하도록 수정된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인하십시오.