🇰🇷 한글 설명
Linux 커널의 nfsd 구성 요소에서 nfsd_net 구조체의 불리언 플래그가 직렬화 없이 동시 접근되어 발생하는 레이스 컨디션 취약점입니다. 이로 인해 여러 컨텍스트에서 동시에 grace 종료 처리가 수행될 경우 리스트 손상 및 double-free 오류가 발생하여 시스템 안정성을 해칠 수 있습니다.
💡 쉬운 설명
여러 작업이 동시에 같은 데이터를 수정하려고 할 때 발생하는 충돌 문제입니다. 이 충돌로 인해 컴퓨터 메모리가 꼬이거나 프로그램이 갑자기 종료될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
nfsd: convert nfsd_net boolean flags to unsigned long flags word
nfsd_net contains several boolean fields that are accessed from
concurrent contexts without serialization. In particular,
nfsd4_end_grace() guards its drain path with a plain bool:
if (nn->grace_ended)
return;
nn->grace_ended = true;
The read and the write are independent, and nothing in struct
nfsd_net serializes them. At least two contexts can reach this
code with no lock held:
laundromat path
laundry_wq kworker
nfs4_laundromat()
nfsd4_end_grace()
RECLAIM_COMPLETE path
nfsd compound kthread
nfsd4_reclaim_complete()
inc_reclaim_complete()
nfsd4_end_grace()
Both callers can observe grace_ended == false on different CPUs,
both store true, and both proceed into nfsd4_record_grace_done(),
which invokes the active client_tracking_ops->grace_done callback.
For tracking ops that drain reclaim_str_hashtbl (legacy_tracking_ops
via nfsd4_recdir_purge_old, and the cld v1+ ops via
nfsd4_cld_grace_done), grace_done calls nfs4_release_reclaim(),
which walks every bucket of reclaim_str_hashtbl with no lock and
calls nfs4_remove_reclaim_record() (list_del + kfree) on each
entry. Two concurrent walkers corrupt the list and double-free
every nfs4_client_reclaim. A concurrent nfsd4_find_reclaim_client()
iterating the same bucket reads through freed memory.
A third call site exists in nfs4_state_start_net() on the
skip_grace startup path, but it runs under nfsd_mutex before any
client has connected and before the laundromat's first delayed
work fires, so it cannot race with the two callers above.
Replace the scattered boolean fields in nfsd_net with a single
unsigned long flags word and an enum nfsd_net_flag for the bit
positions. The grace_ended race is fixed by using
test_and_set_bit(), which is atomic on all architectures. The
remaining flags (grace_end_forced, in_grace, somebody_reclaimed,
track_reclaim_completes, nfsd_net_up, lockd_up) are converted to
use test_bit/set_bit/clear_bit for consistency. This avoids
sub-word cmpxchg issues on architectures like Hexagon that only
support word-sized atomic operations.
📍 영향받는 시스템
Linux Kernel (nfsd 모듈 사용 환경)
⚔️ 공격 벡터
NFSv4 프로토콜을 사용하는 환경에서 특정 레이스 컨디션을 유발하는 네트워크 요청 전송
🛡️ 대응 방법
불리언 플래그를 원자적 연산(test_and_set_bit)이 가능한 unsigned long 플래그로 교체한 최신 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인합니다.