🇰🇷 한글 설명
Linux 커널의 F2FS 파일 시스템에서 캐시된 IPU bio를 처리할 때 발생하는 Use-After-Free 취약점입니다. cp_error 발생 시 f2fs_submit_merged_ipu_write 함수가 bio 매개변수의 유효성을 확인하지 않아 잘못된 IO 컨텍스트의 bio를 제출함으로써 발생합니다.
💡 쉬운 설명
파일 시스템이 데이터를 저장하는 과정에서 이미 사용이 끝난 메모리 영역을 다시 사용하려고 시도하는 오류입니다. 이로 인해 시스템이 갑자기 멈추거나 데이터가 손상될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
f2fs: fix to avoid use-after-free for cached IPU bio
xfstest generic/019 reports a bug:
kernel BUG at mm/filemap.c:1619!
RIP: 0010:folio_end_writeback+0x8a/0x90
Call Trace:
end_page_writeback+0x1c/0x60
f2fs_write_end_io+0x199/0x420
bio_endio+0x104/0x180
submit_bio_noacct+0xa5/0x510
submit_bio+0x48/0x80
f2fs_submit_write_bio+0x35/0x300
f2fs_submit_merged_ipu_write+0x2a0/0x2b0
f2fs_write_single_data_page+0x838/0x8b0
f2fs_write_cache_pages+0x379/0xa30
f2fs_write_data_pages+0x30c/0x340
do_writepages+0xd8/0x1b0
__writeback_single_inode+0x44/0x370
writeback_sb_inodes+0x233/0x4d0
__writeback_inodes_wb+0x56/0xf0
wb_writeback+0x1dd/0x2d0
wb_workfn+0x367/0x4a0
process_one_work+0x21d/0x430
worker_thread+0x4e/0x3c0
kthread+0x103/0x130
ret_from_fork+0x2c/0x50
The root cause is: after cp_error is set, f2fs_submit_merged_ipu_write()
in f2fs_write_single_data_page() tries to flush IPU bio in cache, however
f2fs_submit_merged_ipu_write() missed to check validity of @bio parameter,
result in submitting random cached bio which belong to other IO context,
then it will cause use-after-free issue, fix it by adding additional
validity check.
📍 영향받는 시스템
F2FS 파일 시스템을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
특정 파일 시스템 오류 상황을 유도하여 잘못된 메모리 참조를 일으키는 방식
🛡️ 대응 방법
F2FS의 bio 유효성 검사 로직이 포함된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 버전인지 확인