🇰🇷 한글 설명
Linux 커널의 nilfs2 파일 시스템에서 sysfs 인터페이스의 생성 및 삭제 시점 문제로 인해 NULL 포인터 역참조, Use-After-Free, 그리고 잠금 의존성 경고가 발생할 수 있는 취약점입니다. 메타데이터 파일의 수명 주기와 sysfs 속성의 수명 주기가 일치하지 않아 메모리 오류나 교착 상태 위험이 존재합니다.
💡 쉬운 설명
파일 시스템의 정보를 보여주는 기능이 실제 데이터가 사라진 뒤에도 작동하려고 시도하여 시스템이 멈추거나 오류가 발생할 수 있는 문제입니다. 데이터가 삭제되는 타이밍과 정보를 보여주는 타이밍이 맞지 않아 발생하는 현상입니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
nilfs2: fix sysfs interface lifetime
The current nilfs2 sysfs support has issues with the timing of creation
and deletion of sysfs entries, potentially leading to null pointer
dereferences, use-after-free, and lockdep warnings.
Some of the sysfs attributes for nilfs2 per-filesystem instance refer to
metadata file "cpfile", "sufile", or "dat", but
nilfs_sysfs_create_device_group that creates those attributes is executed
before the inodes for these metadata files are loaded, and
nilfs_sysfs_delete_device_group which deletes these sysfs entries is
called after releasing their metadata file inodes.
Therefore, access to some of these sysfs attributes may occur outside of
the lifetime of these metadata files, resulting in inode NULL pointer
dereferences or use-after-free.
In addition, the call to nilfs_sysfs_create_device_group() is made during
the locking period of the semaphore "ns_sem" of nilfs object, so the
shrinker call caused by the memory allocation for the sysfs entries, may
derive lock dependencies "ns_sem" -> (shrinker) -> "locks acquired in
nilfs_evict_inode()".
Since nilfs2 may acquire "ns_sem" deep in the call stack holding other
locks via its error handler __nilfs_error(), this causes lockdep to report
circular locking. This is a false positive and no circular locking
actually occurs as no inodes exist yet when
nilfs_sysfs_create_device_group() is called. Fortunately, the lockdep
warnings can be resolved by simply moving the call to
nilfs_sysfs_create_device_group() out of "ns_sem".
This fixes these sysfs issues by revising where the device's sysfs
interface is created/deleted and keeping its lifetime within the lifetime
of the metadata files above.
📍 영향받는 시스템
nilfs2 파일 시스템을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
로컬 공격자가 특정 조건에서 sysfs 속성에 접근하여 커널 메모리 오류 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인