🇰🇷 한글 설명
Linux 커널의 romfs 파일 시스템에서 sb_set_blocksize()의 반환 값을 확인하지 않아 발생하는 취약점입니다. 루프 장치의 블록 크기를 PAGE_SIZE보다 크게 설정한 후 romfs를 마운트하면, 잘못된 블록 크기로 인해 커널 BUG가 발생하며 시스템이 중단될 수 있습니다.
💡 쉬운 설명
파일 시스템을 불러올 때 설정값이 잘못되었음에도 이를 무시하고 진행하여 컴퓨터 시스템이 멈추거나 오류를 일으키는 문제입니다. 특정 설정이 적용된 가짜 저장 장치를 연결할 때 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
romfs: check sb_set_blocksize() return value
romfs_fill_super() ignores the return value of sb_set_blocksize(), which
can fail if the requested block size is incompatible with the block
device's configuration.
This can be triggered by setting a loop device's block size larger than
PAGE_SIZE using ioctl(LOOP_SET_BLOCK_SIZE, 32768), then mounting a romfs
filesystem on that device.
When sb_set_blocksize(sb, ROMBSIZE) is called with ROMBSIZE=4096 but the
device has logical_block_size=32768, bdev_validate_blocksize() fails
because the requested size is smaller than the device's logical block
size. sb_set_blocksize() returns 0 (failure), but romfs ignores this and
continues mounting.
The superblock's block size remains at the device's logical block size
(32768). Later, when sb_bread() attempts I/O with this oversized block
size, it triggers a kernel BUG in folio_set_bh():
kernel BUG at fs/buffer.c:1582!
BUG_ON(size > PAGE_SIZE);
Fix by checking the return value of sb_set_blocksize() and failing the
mount with -EINVAL if it returns 0.
📍 영향받는 시스템
Linux kernel (romfs module 사용 환경)
⚔️ 공격 벡터
ioctl(LOOP_SET_BLOCK_SIZE)을 통해 블록 크기를 조작한 루프 장치에 romfs를 마운트하여 발생
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 sb_set_blocksize() 반환 값 검증 로직을 적용해야 함
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인