🇰🇷 한글 설명
Linux 커널의 RDMA/core 구성 요소에서 ib block iterator 카운터 오버플로 취약점이 발견되었습니다. 특정 조건에서 DMA MR 등록 시 sg entry 크기가 4GB 이상이 될 경우, 32비트(u32) 카운터가 오버플로되어 무한 루프가 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터가 데이터를 처리할 때 사용하는 숫자의 저장 공간이 너무 작아서 발생하는 문제입니다. 데이터 크기가 너무 크면 숫자가 다시 0으로 돌아가 버려, 컴퓨터가 끝을 찾지 못하고 무한히 반복 작업에 빠지게 됩니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
RDMA/core: Fix ib block iterator counter overflow
When registering a new DMA MR after selecting the best aligned page size
for it, we iterate over the given sglist to split each entry to smaller,
aligned to the selected page size, DMA blocks.
In given circumstances where the sg entry and page size fit certain
sizes and the sg entry is not aligned to the selected page size, the
total size of the aligned pages we need to cover the sg entry is >= 4GB.
Under this circumstances, while iterating page aligned blocks, the
counter responsible for counting how much we advanced from the start of
the sg entry is overflowed because its type is u32 and we pass 4GB in
size. This can lead to an infinite loop inside the iterator function
because the overflow prevents the counter to be larger
than the size of the sg entry.
Fix the presented problem by changing the advancement condition to
eliminate overflow.
Backtrace:
[ 192.374329] efa_reg_user_mr_dmabuf
[ 192.376783] efa_register_mr
[ 192.382579] pgsz_bitmap 0xfffff000 rounddown 0x80000000
[ 192.386423] pg_sz [0x80000000] umem_length[0xc0000000]
[ 192.392657] start 0x0 length 0xc0000000 params.page_shift 31 params.page_num 3
[ 192.399559] hp_cnt[3], pages_in_hp[524288]
[ 192.403690] umem->sgt_append.sgt.nents[1]
[ 192.407905] number entries: [1], pg_bit: [31]
[ 192.411397] biter->__sg_nents [1] biter->__sg [0000000008b0c5d8]
[ 192.415601] biter->__sg_advance [665837568] sg_dma_len[3221225472]
[ 192.419823] biter->__sg_nents [1] biter->__sg [0000000008b0c5d8]
[ 192.423976] biter->__sg_advance [2813321216] sg_dma_len[3221225472]
[ 192.428243] biter->__sg_nents [1] biter->__sg [0000000008b0c5d8]
[ 192.432397] biter->__sg_advance [665837568] sg_dma_len[3221225472]
📍 영향받는 시스템
Linux kernel (RDMA/core 관련 모듈 사용 시스템)
⚔️ 공격 벡터
특수하게 조작된 sglist를 사용하여 DMA MR을 등록함으로써 커널 내 무한 루프 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 카운터 오버플로 방지 로직 적용
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 패치 버전인지 배포판 보안 공지를 통해 확인