🇰🇷 한글 설명
Linux 커널 vsock 모듈에서 TCP_ESTABLISHED에서 TCP_CLOSING으로 전이되는 과정이 OP_RST 처리 시 connect 루프와 경합할 수 있는 문제가 수정되었습니다. 이미 연결된 소켓이 connected_table에 남아있는 상태에서 리셋되면 리스트 이중 삽입으로 인한 메모리 손상과 커널 패닉이 발생할 수 있습니다.
💡 쉬운 설명
가상 머신과 호스트 사이의 소켓 통신에서 연결 중 종료 신호가 겹치면 커널이 잘못된 메모리 조작을 하여 시스템이 멈출 수 있었습니다. 이번 수정으로 연결이 이미 성립된 뒤에 발생한 이벤트가 연결 결과에 영향을 주지 않도록 바로잡았습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
vsock: treat TCP_CLOSING as once-established
Handle the TCP_ESTABLISHED -> TCP_CLOSING transition on OP_RST, which can
race with the connect loop. Immediately break and return 0 on
ESTABLISHED/CLOSING. The return value of connect() should reflect what
happened up to the point the connection was established or failed. Events
that occur afterwards must not affect it. E.g. even if OP_RW has already
set sk_err, connect() should still return 0, not ENOBUFS because of it.
Adapt the inaccurate comment above signal_pending().
Resetting a socket that is still present in connected_table can lead to
memory corruption. The reporter noted lost transports for in-flight skbs,
and I have reproduced crashes caused by re-insertion into connected_table.
list_add double add: new=, prev=, next=.
kernel BUG at lib/list_debug.c:35!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
Workqueue: vsock-loopback vsock_loopback_work
RIP: 0010:__list_add_valid_or_report+0x11f/0x130
Call Trace:
vsock_insert_connected.cold+0xe/0x13
virtio_transport_recv_pkt+0x10e9/0x1460
vsock_loopback_work+0x305/0x480
process_one_work+0xe4c/0x1560
worker_thread+0x4f1/0xd60
kthread+0x36e/0x470
ret_from_fork+0x47b/0x6b0
ret_from_fork_asm+0x1a/0x30
This fix is supplementary to commit 002541ef650b ("vsock: Ignore
signal/timeout on connect() if already established"). Details under Link.
📍 영향받는 시스템
vsock 기능을 포함한 Linux 커널 (수정 커밋 이전의 대부분 배포판 커널)
⚔️ 공격 벡터
로컬 또는 가상화 환경에서 vsock 연결 및 RST 패킷 타이밍을 조작해 경합 조건을 유발하고 커널 메모리 손상을 일으키는 방식
🛡️ 대응 방법
배포판에서 제공하는 최신 커널 보안 업데이트를 적용하고 재부팅합니다.
🔧 검증 코드
커널 버전이 배포판의 수정된 패치 버전 이상인지 확인하고, vsock 모듈이 로드되지 않았다면 이 취약점의 영향을 받지 않는 것으로 판단합니다.
uname -r && (lsmod | grep -E 'vsock|vmw_vsock' || echo 'vsock module not loaded')