🇰🇷 한글 설명
Linux 커널의 netfs 모듈에서 쓰기 재시도 시 stream->prepare_write() NULL 포인터 확인이 누락되어 발생하는 결함입니다. 9P 같은 파일시스템은 prepare_write 작업을 설정하지 않아, get_user_pages() 실패로 인한 재시도 시 NULL 포인터 역참조가 발생합니다. 수정은 prepare_write 존재 여부를 확인하고 NULL일 경우 netfs_reissue_write()를 직접 호출하는 방식입니다.
💡 쉬운 설명
리눅스 커널이 파일 쓰기 중 실패한 작업을 다시 시도할 때, 특정 함수가 존재하는지 확인하지 않고 호출하는 버그입니다. 이 함수가 없는 파일시스템(9P 등)에서 충돌이 발생합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
netfs: Fix NULL pointer dereference in netfs_unbuffered_write() on retry
When a write subrequest is marked NETFS_SREQ_NEED_RETRY, the retry path
in netfs_unbuffered_write() unconditionally calls stream->prepare_write()
without checking if it is NULL.
Filesystems such as 9P do not set the prepare_write operation, so
stream->prepare_write remains NULL. When get_user_pages() fails with
-EFAULT and the subrequest is flagged for retry, this results in a NULL
pointer dereference at fs/netfs/direct_write.c:189.
Fix this by mirroring the pattern already used in write_retry.c: if
stream->prepare_write is NULL, skip renegotiation and directly reissue
the subrequest via netfs_reissue_write(), which handles iterator reset,
IN_PROGRESS flag, stats update and reissue internally.
📍 영향받는 시스템
Linux kernel netfs (network filesystem) 모듈 사용 시스템, 특히 9P 파일시스템 지원 환경
⚔️ 공격 벡터
로컬에서 메모리 접근 제한 조건에서 쓰기 작업 시도 시 커널 패닉 유발
🛡️ 대응 방법
최신 Linux 커널 패치 적용 (관련 netfs 모듈 수정사항 포함)
🔧 검증 코드
커널 버전 확인 후 netfs 모듈 존재 여부로 영향 범위 파악, 최신 패치 적용 여부 확인
uname -r && grep -r 'netfs_unbuffered_write' /lib/modules/$(uname -r)/kernel/ 2>/dev/null | head -1