🇰🇷 한글 설명
Linux 커널의 net/smc 구성 요소에서 smc_listen_out() 함수와 리스너 종료 과정 사이에 TOCTOU(Time-of-Check to Time-of-Use) 레이스 컨디션 취약점이 발견되었습니다. 이로 인해 리스너가 닫히는 도중 연결 요청이 처리되면 소켓 참조가 해제되지 않아 커널 메모리가 누수될 수 있습니다.
💡 쉬운 설명
서버가 연결을 종료하는 순간에 동시에 새로운 연결 요청이 들어오면, 컴퓨터가 메모리를 제대로 정리하지 못하고 계속 쌓아두게 됩니다. 공격자가 이를 반복하면 서버의 메모리가 가득 차서 시스템이 멈출 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net/smc: fix TOCTOU race between smc_listen_out() and listener close
smc_listen_out() reads lsmc->sk.sk_state without the listener lock,
then acquires lock_sock_nested() only after the check passes. This
opens a window where smc_close_active() can transition the listener
to SMC_CLOSED, call smc_close_cleanup_listen() to drain the accept
queue, and release the lock, all between the lockless read and the
delayed lock acquisition:
smc_listen_work (smc_hs_wq) smc_close_active()
------------------------------- -------------------------
release_sock(child)
if (sk_state == SMC_LISTEN) TRUE
lock_sock(listener)
sk_state = SMC_CLOSED
smc_close_cleanup_listen()
release_sock(listener)
flush_work(tcp_listen_work)
lock_sock_nested(listener)
smc_accept_enqueue(listener, child) /* child enqueued on dead listener */
smc_close_active() flushes only tcp_listen_work. Work items already
dispatched onto smc_hs_wq for the CLC handshake continue running
unguarded. smc_accept_enqueue() takes a sock_hold() on the child that
is never released, so the child smc_sock, its clcsock, and the
reference all leak. A remote peer that opens TCP connections while the
server calls close() can exhaust kernel memory.
Move lock_sock_nested() to before the sk_state check so that the test
and the enqueue are atomic under the listener lock.
📍 영향받는 시스템
Linux kernel (net/smc 모듈 사용 시)
⚔️ 공격 벡터
원격 공격자가 서버가 연결을 종료하는 시점에 맞춰 지속적으로 TCP 연결을 시도하여 커널 메모리 고갈 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 smc_listen_out()의 잠금 메커니즘 수정 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인