🇰🇷 한글 설명
Linux 커널의 net/smc 구성 요소에서 REQ_ADD_LINK 상태가 ADD_LINK 상태로 전환될 때, 기존에 저장된 qentry를 해제하지 않고 덮어쓰는 취약점이 발견되었습니다. 이로 인해 kmalloc 객체가 해제되지 않고 메모리에 남게 되는 메모리 누수(Memory Leak)가 발생할 수 있습니다.
💡 쉬운 설명
데이터를 처리하는 과정에서 기존에 사용하던 메모리 공간을 비우지 않고 새 데이터를 덮어씌워 메모리가 낭비되는 문제입니다. 이 현상이 반복되면 시스템의 메모리가 점차 부족해질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net/smc: free stashed qentry before overwrite in REQ_ADD_LINK to ADD_LINK transition
When smc_llc_event_handler() transitions the local LLC flow from
SMC_LLC_FLOW_REQ_ADD_LINK to SMC_LLC_FLOW_ADD_LINK on arrival of an ADD_LINK
request, it calls smc_llc_flow_qentry_set() unconditionally:
if (lgr->llc_flow_lcl.type == SMC_LLC_FLOW_REQ_ADD_LINK) {
lgr->llc_flow_lcl.type = SMC_LLC_FLOW_ADD_LINK;
smc_llc_flow_qentry_set(&lgr->llc_flow_lcl, qentry);
...
}
A CONFIRM_LINK or ADD_LINK_CONT arriving while flow->type is
SMC_LLC_FLOW_REQ_ADD_LINK is stashed into flow->qentry via the
SMC_LLC_CONFIRM_LINK / SMC_LLC_ADD_LINK_CONT handler (which stores into
flow->qentry for any non-NONE flow type). When the subsequent ADD_LINK
arrives, the REQ_ADD_LINK branch overwrites flow->qentry with the new pointer
without first freeing the stashed allocation, leaking one kmalloc object.
The stashed entry has no consumer: smc_llc_wait() is only called from
llc_add_link_work, which is not yet scheduled while the flow type remains
REQ_ADD_LINK. No waiter is sleeping on llc_msg_waiter at this point.
It is safe to unconditionally free any stashed qentry before
the overwrite.
Call smc_llc_flow_qentry_del() before smc_llc_flow_qentry_set() in the
REQ_ADD_LINK branch. smc_llc_flow_qentry_del() already checks flow->qentry
before freeing, so the normal path where no entry is stashed is a no-op.
📍 영향받는 시스템
Linux Kernel (net/smc 모듈 사용 시)
⚔️ 공격 벡터
특정 네트워크 프로토콜(SMC LLC)의 ADD_LINK 요청을 조작하여 메모리 누수를 유도하는 방식
🛡️ 대응 방법
smc_llc_flow_qentry_del() 함수를 호출하여 데이터 덮어쓰기 전 기존 qentry를 해제하도록 커널 패치 적용
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 해결된 최신 패치 버전인지 확인합니다.