🇰🇷 한글 설명
Linux 커널의 RDS(Reliable Datagram Sockets) InfiniBand 모듈에서, rds_ib_map_frmr()이 DMA 매핑 또는 등록 실패 시 caller의 scatterlist 포인터를 MR에 남겨둔 채 풀에 반환하는 문제가 해결되었습니다. 이로 인해 발생하던 use-after-free 취약점을 수정하기 위해, scatterlist는 DMA 매핑 성공 후에만 저장되며 실패 시 MR 필드를 명확히 초기화합니다.
💡 쉬운 설명
리눅스 커널이 메모리 영역을 이미 해제했는데도 그 주소를 계속 참조하는 버그가 있었습니다. 이 버그를 악용하면 일반 사용자가 시스템 관리자 권한을 얻을 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
rds: ib: Clear the sg list when mapping an MR fails
rds_ib_map_frmr() stores the caller's scatterlist in the MR before DMA
mapping and registration can fail. On failure, __rds_rdma_map() unpins
the pages and frees the scatterlist, but rds_ib_free_frmr() can still
return the MR to the pool with the stale pointer set.
This leaves the pool with a dangling scatterlist and can lead to local
privilege escalation. KASAN detects the resulting use-after-free when the
MR is later torn down:
BUG: KASAN: slab-use-after-free in __rds_ib_teardown_mr
Read of size 8
Call Trace:
__rds_ib_teardown_mr
rds_ib_unreg_frmr
rds_ib_flush_mr_pool
rds_ib_flush_mrs
rds_free_mr
rds_setsockopt
Store the scatterlist in the MR only after DMA mapping succeeds. If DMA
mapping fails, return directly while the MR fields remain clear; the caller
keeps ownership of the scatterlist and its pinned pages. If a later
registration step fails, unmap the scatterlist and clear the MR fields
before returning.
📍 영향받는 시스템
RDS InfiniBand 기능을 포함한 수정 이전의 Linux 커널 버전 (배포판별 패치 적용 버전 확인 필요)
⚔️ 공격 벡터
지역(로컬) 사용자가 RDS 소켓의 setsockopt를 통해 실패하는 MR 매핑을 유도한 뒤, 해제된 메모리를 재사용하여 권한 상승을 시도
🛡️ 대응 방법
벤더가 제공하는 최신 커널 보안 업데이트를 적용하고 시스템을 재부팅하며, 필요 없다면 rds 모듈을 비활성화
🔧 검증 코드
커널 버전이 배포판의 수정된 보안 업데이트 버전 이상인지 확인하고, rds 모듈이 로드되지 않았다면 해당 공격 경로는 노출되지 않은 것으로 판단
uname -r; lsmod | grep -E '^rds' || echo 'rds module not loaded'