🇰🇷 한글 설명
Linux 커널의 nvmet 구성 요소에서 nvmet_bio_done() 함수 내 레이스 컨디션(경쟁 상태)으로 인해 NULL 포인터 역참조가 발생할 수 있는 취약점입니다. 요청이 재제출되는 과정에서 bio 구조체의 블록 그룹 정보가 초기화되어 커널 크래시를 유발할 수 있습니다.
💡 쉬운 설명
데이터를 처리하는 과정에서 두 가지 작업이 동시에 일어나 순서가 꼬이면서 시스템이 참조할 수 없는 빈 주소를 건드려 컴퓨터가 멈추는 문제입니다. 이로 인해 리눅스 시스템이 갑자기 꺼지거나 오류가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
nvmet: fix race in nvmet_bio_done() leading to NULL pointer dereference
There is a race condition in nvmet_bio_done() that can cause a NULL
pointer dereference in blk_cgroup_bio_start():
1. nvmet_bio_done() is called when a bio completes
2. nvmet_req_complete() is called, which invokes req->ops->queue_response(req)
3. The queue_response callback can re-queue and re-submit the same request
4. The re-submission reuses the same inline_bio from nvmet_req
5. Meanwhile, nvmet_req_bio_put() (called after nvmet_req_complete)
invokes bio_uninit() for inline_bio, which sets bio->bi_blkg to NULL
6. The re-submitted bio enters submit_bio_noacct_nocheck()
7. blk_cgroup_bio_start() dereferences bio->bi_blkg, causing a crash:
BUG: kernel NULL pointer dereference, address: 0000000000000028
#PF: supervisor read access in kernel mode
RIP: 0010:blk_cgroup_bio_start+0x10/0xd0
Call Trace:
submit_bio_noacct_nocheck+0x44/0x250
nvmet_bdev_execute_rw+0x254/0x370 [nvmet]
process_one_work+0x193/0x3c0
worker_thread+0x281/0x3a0
Fix this by reordering nvmet_bio_done() to call nvmet_req_bio_put()
BEFORE nvmet_req_complete(). This ensures the bio is cleaned up before
the request can be re-submitted, preventing the race condition.
📍 영향받는 시스템
Race condition이 존재하는 Linux kernel (nvmet 모듈 사용 시)
⚔️ 공격 벡터
특정 조건에서 NVMe-over-Fabrics 요청을 재제출하도록 유도하여 커널 패닉 유발
🛡️ 대응 방법
nvmet_req_bio_put() 호출 순서를 nvmet_req_complete() 이전으로 변경하여 커널 패치 적용
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 확인합니다.