🇰🇷 한글 설명
리눅스 커널의 HMM 테스트 모듈에서 파일 닫기 시 장치 페이지를 시스템 메모리로 마이그레이션하지 않아 발생한 Use-After-Free 취약점입니다. 해제된 구조체를 참조하는 stale 포인터로 인해 커널 패닉이 발생할 수 있습니다.
💡 쉬운 설명
시스템 종료 시 필요한 메모리 정리 작업을 건너뛰어 발생하는 오류입니다. 이로 인해 시스템이 갑자기 충돌하거나 재시작될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
lib: test_hmm: evict device pages on file close to avoid use-after-free
Patch series "Minor hmm_test fixes and cleanups".
Two bugfixes a cleanup for the HMM kernel selftests. These were mostly
reported by Zenghui Yu with special thanks to Lorenzo for analysing and
pointing out the problems.
This patch (of 3):
When dmirror_fops_release() is called it frees the dmirror struct but
doesn't migrate device private pages back to system memory first. This
leaves those pages with a dangling zone_device_data pointer to the freed
dmirror.
If a subsequent fault occurs on those pages (eg. during coredump) the
dmirror_devmem_fault() callback dereferences the stale pointer causing a
kernel panic. This was reported [1] when running mm/ksft_hmm.sh on arm64,
where a test failure triggered SIGABRT and the resulting coredump walked
the VMAs faulting in the stale device private pages.
Fix this by calling dmirror_device_evict_chunk() for each devmem chunk in
dmirror_fops_release() to migrate all device private pages back to system
memory before freeing the dmirror struct. The function is moved earlier
in the file to avoid a forward declaration.
📍 영향받는 시스템
Linux kernel (HMM 테스트 모듈 포함 빌드)
⚔️ 공격 벡터
테스트 실행 중 coredump 발생 시 stale 포인터 접근을 통한 커널 패닉 유발
🛡️ 대응 방법
커널 패치 적용 또는 dmirror_device_evict_chunk() 호출을 통한 장치 페이지 마이그레이션
🔧 검증 코드
출력된 커널 버전이 패치가 적용된 최신 버전인지 확인