🇰🇷 한글 설명
Linux 커널 cifs 모듈에서 fscache 캐시 히트 시 읽기 작업 중 페이지(folio) 잠금이 해제되지 않아 발생하는 문제가 수정되었습니다. 이로 인해 이후 mmap 읽기에서 교착 상태가 발생하여 재부팅이 필요했습니다. 패치는 cifs_readpage_worker가 읽기 완료 후 항상 잠금을 해제하도록 동작을 맞춥니다.
💡 쉬운 설명
컴퓨터가 네트워크 공유 폴더의 파일을 임시 저장소에서 읽을 때 잠금이 풀리지 않는 버그가 있었습니다. 그 결과 같은 파일에 다시 접근하면 프로그램이 멈추고 재부팅해야 했습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
cifs: Release folio lock on fscache read hit.
Under the current code, when cifs_readpage_worker is called, the call
contract is that the callee should unlock the page. This is documented
in the read_folio section of Documentation/filesystems/vfs.rst as:
> The filesystem should unlock the folio once the read has completed,
> whether it was successful or not.
Without this change, when fscache is in use and cache hit occurs during
a read, the page lock is leaked, producing the following stack on
subsequent reads (via mmap) to the page:
$ cat /proc/3890/task/12864/stack
[<0>] folio_wait_bit_common+0x124/0x350
[<0>] filemap_read_folio+0xad/0xf0
[<0>] filemap_fault+0x8b1/0xab0
[<0>] __do_fault+0x39/0x150
[<0>] do_fault+0x25c/0x3e0
[<0>] __handle_mm_fault+0x6ca/0xc70
[<0>] handle_mm_fault+0xe9/0x350
[<0>] do_user_addr_fault+0x225/0x6c0
[<0>] exc_page_fault+0x84/0x1b0
[<0>] asm_exc_page_fault+0x27/0x30
This requires a reboot to resolve; it is a deadlock.
Note however that the call to cifs_readpage_from_fscache does mark the
page clean, but does not free the folio lock. This happens in
__cifs_readpage_from_fscache on success. Releasing the lock at that
point however is not appropriate as cifs_readahead also calls
cifs_readpage_from_fscache and *does* unconditionally release the lock
after its return. This change therefore effectively makes
cifs_readpage_worker work like cifs_readahead.
📍 영향받는 시스템
수정 전 Linux 커널의 cifs(SMB/CIFS) 파일시스템 모듈을 fscache와 함께 사용하는 시스템 (커널 버전별 패치 적용 여부 확인 필요)
⚔️ 공격 벡터
직접적인 원격 공격 경로보다는 SMB 공유 파일에 대한 정상적인 읽기 작업 중 발생하는 서비스 거부(교착 상태) 문제입니다.
🛡️ 대응 방법
배포판 제공 커널 보안/버그 수정 업데이트를 설치하고 재부팅하거나, 해당 패치가 포함된 커널 버전으로 업그레이드하세요.
🔧 검증 코드
첫 줄은 현재 실행 중인 커널 버전을, 둘째 줄은 fscache 지원 여부를 보여줍니다. 커널 버전을 배포판 보안 공지의 수정 버전과 비교하고, CONFIG_CIFS_FSCACHE=y 또는 m이면 해당 기능이 활성화되어 있어 업데이트 확인이 필요합니다.
uname -r; grep -E '^CONFIG_CIFS_FSCACHE=' /boot/config-$(uname -r) 2>/dev/null