🇰🇷 한글 설명
Linux 커널의 netfs 구성 요소에서 쓰기 전용(writethrough) 모드로 파일에 데이터를 추가할 때 발생하는 취약점입니다. 파일 끝(EOF) 위치에서 쓰기 작업을 수행할 때 데이터 플러시 및 대기 과정을 건너뛰어, 데이터 일관성 문제와 커널 경고(WARNING)를 유발할 수 있습니다.
💡 쉬운 설명
파일에 데이터를 저장할 때 기존에 진행 중인 작업이 끝날 때까지 기다리지 않아 시스템이 혼란을 겪는 문제입니다. 이로 인해 데이터가 제대로 저장되지 않거나 시스템에 오류 경고가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
netfs: Fix the pre-flush when appending to a file in writethrough mode
In netfs_perform_write(), when the file is marked NETFS_ICTX_WRITETHROUGH
or O_*SYNC or RWF_*SYNC was specified, write-through caching is performed
on a buffered file. When setting up for write-through, we flush any
conflicting writes in the region and wait for the write to complete,
failing if there's a write error to return.
The issue arises if we're writing at or above the EOF position because we
skip the flush and - more importantly - the wait. This becomes a problem
if there's a partial folio at the end of the file that is being written out
and we want to make a write to it too. Both the already-running write and
the write we start both want to clear the writeback mark, but whoever is
second causes a warning looking something like:
------------[ cut here ]------------
R=00000012: folio 11 is not under writeback
WARNING: CPU: 34 PID: 654 at fs/netfs/write_collect.c:105
...
CPU: 34 PID: 654 Comm: kworker/u386:27 Tainted: G S ...
...
Workqueue: events_unbound netfs_write_collection_worker
...
RIP: 0010:netfs_writeback_lookup_folio
Fix this by making the flush-and-wait unconditional. It will do nothing if
there are no folios in the pagecache and will return quickly if there are
no folios in the region specified.
Further, move the WBC attachment above the flush call as the flush is going
to attach a WBC and detach it again if it is not present - and since we
need one anyway we might as well share it.
📍 영향받는 시스템
Linux Kernel (netfs 구성 요소가 포함된 버전)
⚔️ 공격 벡터
로컬 사용자가 특정 쓰기 옵션(writethrough, SYNC 등)을 사용하여 파일 끝에 데이터를 추가하는 동작을 통해 유발 가능
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 netfs의 flush-and-wait 로직을 수정해야 합니다.
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 확인합니다.