🇰🇷 한글 설명
Linux 커널의 nfsd 구성 요소에서 NFSv4 파일 생성 시 캐시된 오픈 파일을 처리하는 과정에 결함이 발견되었습니다. 이로 인해 레이스 컨디션(Race Condition)이 발생하여 NULL 포인터 참조로 인한 시스템 오류(Oops)가 발생하거나, 기존 파일 포인터가 덮어씌워지며 메모리 누수가 발생할 수 있습니다.
💡 쉬운 설명
리눅스 서버에서 파일을 공유하는 기능(NFS)을 사용할 때, 파일 처리 순서가 꼬여서 시스템이 갑자기 멈추거나 메모리가 낭비되는 문제가 있습니다. 이는 특정 상황에서 컴퓨터가 잘못된 메모리 주소를 참조하려고 할 때 발생합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
nfsd: fix handling of cached open files in nfsd4_open codepath
Commit fb70bf124b05 ("NFSD: Instantiate a struct file when creating a
regular NFSv4 file") added the ability to cache an open fd over a
compound. There are a couple of problems with the way this currently
works:
It's racy, as a newly-created nfsd_file can end up with its PENDING bit
cleared while the nf is hashed, and the nf_file pointer is still zeroed
out. Other tasks can find it in this state and they expect to see a
valid nf_file, and can oops if nf_file is NULL.
Also, there is no guarantee that we'll end up creating a new nfsd_file
if one is already in the hash. If an extant entry is in the hash with a
valid nf_file, nfs4_get_vfs_file will clobber its nf_file pointer with
the value of op_file and the old nf_file will leak.
Fix both issues by making a new nfsd_file_acquirei_opened variant that
takes an optional file pointer. If one is present when this is called,
we'll take a new reference to it instead of trying to open the file. If
the nfsd_file already has a valid nf_file, we'll just ignore the
optional file and pass the nfsd_file back as-is.
Also rework the tracepoints a bit to allow for an "opened" variant and
don't try to avoid counting acquisitions in the case where we already
have a cached open file.
📍 영향받는 시스템
NFSv4를 사용하는 Linux 커널 버전 (fb70bf124b05 커밋 적용 전 버전)
⚔️ 공격 벡터
NFSv4 프로토콜을 통해 특정 컴파운드(Compound) 요청을 보내 레이스 컨디션을 유도하여 시스템 오류 유발
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트 (커밋 fb70bf124b05 포함 버전)
🔧 검증 코드
명령어 결과에 해당 커밋 해시나 관련 메시지가 나타나면 패치가 적용된 상태입니다.
git log --oneline | grep -E 'fb70bf124b05|NFSD: Instantiate a struct file'