🇰🇷 한글 설명
리눅스 커널의 GPIO cdev 구현에서 파일 디스크립터의 참조 횟수가 0이 된 후 .release() 콜백이 호출되기 전 사이에 이벤트가 발생할 수 있는 취약점입니다. 이 과정에서 잘못된 파일 참조가 발생하여 Use-After-Free(UAF) 조건이 형성될 수 있습니다.
💡 쉬운 설명
파일이 닫히는 과정에서 시스템이 아직 사용 중인 것으로 착각하여 이미 사라진 데이터를 참조할 수 있는 오류입니다. 이로 인해 시스템이 불안정해지거나 보안 문제가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
gpio: cdev: make sure the cdev fd is still active before emitting events
With the final call to fput() on a file descriptor, the release action
may be deferred and scheduled on a work queue. The reference count of
that descriptor is still zero and it must not be used. It's possible
that a GPIO change, we want to notify the user-space about, happens
AFTER the reference count on the file descriptor associated with the
character device went down to zero but BEFORE the .release() callback
was called from the workqueue and so BEFORE we unregistered from the
notifier.
Using the regular get_file() routine in this situation triggers the
following warning:
struct file::f_count incremented from zero; use-after-free condition present!
So use the get_file_active() variant that will return NULL on file
descriptors that have been or are being released.
📍 영향받는 시스템
GPIO cdev를 사용하는 리눅스 커널 버전
⚔️ 공격 벡터
GPIO 상태 변화를 유도하여 파일 디스크립터 해제 과정 중의 Race Condition을 이용한 Use-After-Free 공격
🛡️ 대응 방법
get_file() 대신 get_file_active()를 사용하는 최신 리눅스 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인합니다.