🇰🇷 한글 설명
Linux 커널의 netfs 구성 요소에서 unbuffered write 스트림의 오류 처리 미흡으로 인해 발생하는 취약점입니다. 모든 하위 요청이 실패할 경우 전송된 데이터 양이 잘못된 값(LONG_MAX)으로 유지되어, splice 작업 시 잘못된 메모리 참조로 인한 커널 패닉(NULL pointer dereference)을 유발할 수 있습니다.
💡 쉬운 설명
데이터를 저장하는 과정에서 오류가 발생했을 때, 시스템이 실제로는 저장되지 않은 데이터를 저장했다고 착각하여 잘못된 메모리 영역을 건드리는 문제입니다. 이로 인해 컴퓨터 시스템이 갑자기 멈추거나 오류(Kernel Oops)가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
netfs: Fix unbuffered write error handling
If all the subrequests in an unbuffered write stream fail, the subrequest
collector doesn't update the stream->transferred value and it retains its
initial LONG_MAX value. Unfortunately, if all active streams fail, then we
take the smallest value of { LONG_MAX, LONG_MAX, ... } as the value to set
in wreq->transferred - which is then returned from ->write_iter().
LONG_MAX was chosen as the initial value so that all the streams can be
quickly assessed by taking the smallest value of all stream->transferred -
but this only works if we've set any of them.
Fix this by adding a flag to indicate whether the value in
stream->transferred is valid and checking that when we integrate the
values. stream->transferred can then be initialised to zero.
This was found by running the generic/750 xfstest against cifs with
cache=none. It splices data to the target file. Once (if) it has used up
all the available scratch space, the writes start failing with ENOSPC.
This causes ->write_iter() to fail. However, it was returning
wreq->transferred, i.e. LONG_MAX, rather than an error (because it thought
the amount transferred was non-zero) and iter_file_splice_write() would
then try to clean up that amount of pipe bufferage - leading to an oops
when it overran. The kernel log showed:
CIFS: VFS: Send error in write = -28
followed by:
BUG: kernel NULL pointer dereference, address: 0000000000000008
with:
RIP: 0010:iter_file_splice_write+0x3a4/0x520
do_splice+0x197/0x4e0
or:
RIP: 0010:pipe_buf_release (include/linux/pipe_fs_i.h:282)
iter_file_splice_write (fs/splice.c:755)
Also put a warning check into splice to announce if ->write_iter() returned
that it had written more than it was asked to.
📍 영향받는 시스템
Linux Kernel (netfs 및 splice 관련 기능이 포함된 버전)
⚔️ 공격 벡터
로컬 공격자가 특정 파일 시스템(예: CIFS)에 대해 용량 부족(ENOSPC) 상황을 유도하여 splice 시스템 호출을 수행함으로써 발생
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 최신 패치 버전인지 확인하십시오.