🇰🇷 한글 설명
Linux kernel의 scsi target 서브시스템에서 configfs 파일 시스템 인터페이스를 통해 같은 세마포어를 중복으로 획득하려는 재귀적 잠금 취약점. target_core_item_dbroot_store() 함수가 filp_open()을 호출할 때 이미 획득한 frag_sem 세마포어를 다시 획득하려고 시도하여 교착 상태 발생 가능.
💡 쉬운 설명
Linux 커널의 파일 설정 시스템에서 같은 파일을 열 때 필요한 잠금(lock)을 중복으로 획득하려고 하는 문제입니다. 이로 인해 시스템이 응답 불가 상태가 될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
scsi: target: Fix recursive locking in __configfs_open_file()
In flush_write_buffer, &p->frag_sem is acquired and then the loaded store
function is called, which, here, is target_core_item_dbroot_store(). This
function called filp_open(), following which these functions were called
(in reverse order), according to the call trace:
down_read
__configfs_open_file
do_dentry_open
vfs_open
do_open
path_openat
do_filp_open
file_open_name
filp_open
target_core_item_dbroot_store
flush_write_buffer
configfs_write_iter
target_core_item_dbroot_store() tries to validate the new file path by
trying to open the file path provided to it; however, in this case, the bug
report shows:
db_root: not a directory: /sys/kernel/config/target/dbroot
indicating that the same configfs file was tried to be opened, on which it
is currently working on. Thus, it is trying to acquire frag_sem semaphore
of the same file of which it already holds the semaphore obtained in
flush_write_buffer(), leading to acquiring the semaphore in a nested manner
and a possibility of recursive locking.
Fix this by modifying target_core_item_dbroot_store() to use kern_path()
instead of filp_open() to avoid opening the file using filesystem-specific
function __configfs_open_file(), and further modifying it to make this fix
compatible.
📍 영향받는 시스템
Linux kernel scsi target core 모듈이 포함된 모든 Linux 시스템
⚔️ 공격 벡터
/sys/kernel/config/target/dbroot 설정 경로에 write 권한이 있는 사용자가 같은 경로를 dbroot로 설정하여 재귀 잠금 유발 및 시스템 중단 가능
🛡️ 대응 방법
최신 Linux kernel로 업그레이드하거나 target_core_item_dbroot_store()를 kern_path() 사용으로 수정한 패치 적용
🔧 검증 코드
CONFIG_TARGET_CORE가 enabled(=y 또는 =m)로 표시되면 영향을 받을 수 있으므로 kernel 버전을 확인하고 해당 CVE 수정 버전 이상인지 확인 필요
grep -i CONFIG_TARGET_CORE /boot/config-$(uname -r) && uname -r