🇰🇷 한글 설명
Linux 커널의 kernfs에서 서로 다른 네임스페이스를 가진 여러 슈퍼블록이 동일한 kernfs_node를 공유할 때 발생하는 xattr 레이스 컨디션 취약점입니다. VFS 계층의 인오드별 잠금만으로는 공유된 kernfs_node의 xattr 구조에 대한 동시 수정을 직렬화하기에 불충분하여 데이터 무결성 문제가 발생할 수 있습니다.
💡 쉬운 설명
서로 다른 영역에서 같은 데이터를 동시에 수정하려고 할 때, 이를 제어하는 잠금 장치가 부족하여 데이터가 꼬이는 문제입니다. 이로 인해 시스템의 파일 속성 정보가 잘못 변경되거나 충돌이 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
kernfs: fix xattr race condition with multiple superblocks
Multiple superblocks with different namespaces can share the same
kernfs_node when kernfs_test_super() finds a matching root but
different namespace. This means multiple inodes from different
superblocks can reference the same kernfs_node->iattr->xattrs
structure.
The VFS layer only holds per-inode locks during xattr operations,
which is insufficient to serialize concurrent xattr modifications on
the shared kernfs_node. This can lead to race conditions in
simple_xattr_set() where the lookup->replace/remove sequence is not
atomic with respect to operations from other superblocks.
Fix this by protecting xattr operations with the existing hashed
kernfs_locks->open_file_mutex[] array, which is already used to
protect per-node open file data. The hashed mutex array provides
scalable per-node serialization (scaled by CPU count, up to 1024 locks
on 32+ CPU systems) with zero memory overhead.
Changes:
- Rename open_file_mutex[] to node_mutex[] to reflect dual purpose
- Add kernfs_node_lock_ptr() and kernfs_node_lock() helpers
- Protect simple_xattr_set() calls in kernfs_xattr_set() and
kernfs_vfs_user_xattr_set() with the hashed mutex
- Update file.c to use new helpers via compatibility wrappers
- Update documentation to explain the extended lock usage
📍 영향받는 시스템
Linux Kernel (kernfs 구성 요소가 포함된 버전)
⚔️ 공격 벡터
서로 다른 네임스페이스를 가진 여러 슈퍼블록을 통해 동일한 kernfs_node의 xattr를 동시에 수정하는 레이스 컨디션 공격
🛡️ 대응 방법
커널 패치를 적용하여 kernfs_node의 xattr 작업 시 hashed mutex를 사용하도록 업데이트해야 합니다.
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 확인합니다.