🇰🇷 한글 설명
Linux 커널의 nfsd 구성 요소에서 nfsd_file 참조 누수가 발생하는 취약점입니다. nfsd4_add_rdaccess_to_wrdeleg() 함수가 기존 참조를 해제하지 않고 덮어쓰거나, 특정 조건에서 참조 카운트가 줄어들지 않아 파일 객체가 메모리에 남게 됩니다. 이로 인해 서버 종료 시 커널 BUG()가 발생하며 시스템이 불안정해질 수 있습니다.
💡 쉬운 설명
파일을 사용하는 기록이 제대로 지워지지 않고 메모리에 계속 쌓이는 버그입니다. 이 문제가 누적되면 서버를 끌 때 시스템이 오류를 일으키며 비정상적으로 종료될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
nfsd: fix nfsd_file reference leak in nfsd4_add_rdaccess_to_wrdeleg()
nfsd4_add_rdaccess_to_wrdeleg() unconditionally overwrites
fp->fi_fds[O_RDONLY] with a newly acquired nfsd_file. However, if
the client already has a SHARE_ACCESS_READ open from a previous OPEN
operation, this action overwrites the existing pointer without
releasing its reference, orphaning the previous reference.
Additionally, the function originally stored the same nfsd_file
pointer in both fp->fi_fds[O_RDONLY] and fp->fi_rdeleg_file with
only a single reference. When put_deleg_file() runs, it clears
fi_rdeleg_file and calls nfs4_file_put_access() to release the file.
However, nfs4_file_put_access() only releases fi_fds[O_RDONLY] when
the fi_access[O_RDONLY] counter drops to zero. If another READ open
exists on the file, the counter remains elevated and the nfsd_file
reference from the delegation is never released. This potentially
causes open conflicts on that file.
Then, on server shutdown, these leaks cause __nfsd_file_cache_purge()
to encounter files with an elevated reference count that cannot be
cleaned up, ultimately triggering a BUG() in kmem_cache_destroy()
because there are still nfsd_file objects allocated in that cache.
📍 영향받는 시스템
Linux Kernel (nfsd 모듈 사용 환경)
⚔️ 공격 벡터
NFSv4 클라이언트가 특정 OPEN 및 SHARE_ACCESS_READ 작업을 반복 수행하여 서버의 참조 카운트를 조작
🛡️ 대응 방법
nfsd 참조 누수 패치가 적용된 최신 Linux 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인