🇰🇷 한글 설명
Linux 커널의 nfsd 구성 요소 내 nfsd_direct_write 함수에서 부분 쓰기(partial-write)를 감지하는 로직에 오류가 있습니다. 이로 인해 데이터가 지정된 길이보다 적게 기록되었음에도 루프가 중단되지 않아, 다음 데이터 세그먼트가 잘못된 파일 오프셋에 기록될 수 있습니다.
💡 쉬운 설명
파일에 데이터를 저장할 때, 데이터가 중간에 끊겨서 저장되어야 하는 상황을 제대로 인식하지 못하는 버그입니다. 이 때문에 데이터가 엉뚱한 위치에 덮어씌워져 파일 내용이 손상될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
nfsd: fix partial-write detection in nfsd_direct_write
nfsd_direct_write() walks a list of write segments and, after each
vfs_iocb_iter_write(), tries to detect a short write so the loop can
stop before placing the next segment at a wrong file offset:
host_err = vfs_iocb_iter_write(file, kiocb, &segments[i].iter);
if (host_err < 0)
return host_err;
*cnt += host_err;
if (host_err < segments[i].iter.count)
break; /* partial write */
vfs_iocb_iter_write() runs the iter through ->write_iter(), which
advances the iter by the number of bytes written. By the time the
check runs, segments[i].iter.count is the residual, not the original
request length:
before write_iter: iter.count == original_len
after write_iter: iter.count == original_len - host_err
The condition then reduces to host_err < original_len - host_err, so
the break fires only when less than half of the segment was written.
Any short write completing between 50% and 99% of the segment slips
through; the loop advances to the next segment with kiocb->ki_pos
only bumped by the short amount, writing the next segment's payload
at the wrong offset and over-reporting *cnt to the NFS client.
Snapshot the segment's byte count before the write and compare
host_err against that snapshot so any short write breaks the loop.
📍 영향받는 시스템
nfsd 모듈을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
NFS 클라이언트가 의도적으로 불완전한 쓰기 요청을 보내 파일 데이터의 무결성을 파괴하거나 잘못된 위치에 데이터를 기록하도록 유도
🛡️ 대응 방법
해당 취약점이 수정된 최신 Linux 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 보안 업데이트 버전인지 확인