🇰🇷 한글 설명
Linux 커널의 habanalabs 드라이버에서 export_dmabuf() 함수 호출 시 발생하는 Use-After-Free(UAF) 취약점입니다. 파일 디스크립터가 설치된 직후 다른 스레드에서 해당 파일을 닫을 경우, 이미 해제된 객체에 접근하게 되어 시스템 불안정이나 권한 상승을 초래할 수 있습니다.
💡 쉬운 설명
파일을 만드는 과정에서 순서가 잘못되어, 이미 삭제된 파일을 다시 사용하려고 시도할 때 발생하는 오류입니다. 이로 인해 컴퓨터 시스템이 멈추거나 해커가 시스템 제어권을 얻을 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
habanalabs: fix UAF in export_dmabuf()
As soon as we'd inserted a file reference into descriptor table, another
thread could close it. That's fine for the case when all we are doing is
returning that descriptor to userland (it's a race, but it's a userland
race and there's nothing the kernel can do about it). However, if we
follow fd_install() with any kind of access to objects that would be
destroyed on close (be it the struct file itself or anything destroyed
by its ->release()), we have a UAF.
dma_buf_fd() is a combination of reserving a descriptor and fd_install().
habanalabs export_dmabuf() calls it and then proceeds to access the
objects destroyed on close. In particular, it grabs an extra reference to
another struct file that will be dropped as part of ->release() for ours;
that "will be" is actually "might have already been".
Fix that by reserving descriptor before anything else and do fd_install()
only when everything had been set up. As a side benefit, we no longer
have the failure exit with file already created, but reference to
underlying file (as well as ->dmabuf_export_cnt, etc.) not grabbed yet;
unlike dma_buf_fd(), fd_install() can't fail.
📍 영향받는 시스템
habanalabs 드라이버를 사용하는 Linux 커널 시스템
⚔️ 공격 벡터
멀티스레딩 환경에서 특정 타이밍에 파일 디스크립터를 닫는 레이스 컨디션(Race Condition) 공격
🛡️ 대응 방법
habanalabs 드라이버의 UAF 취약점이 수정된 최신 Linux 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 취약점이 패치된 최신 보안 업데이트 버전인지 확인합니다.