🇰🇷 한글 설명
Linux 커널의 tls_sw_cancel_work_tx() 함수에서 발생하는 레이스 컨디션으로, cancel_delayed_work_sync() 호출 후에도 다른 경로에서 tx_work_handler()가 스케줄되어 해제된 TLS 객체를 역참조할 수 있습니다. 이를 수정하기 위해 cancel_delayed_work_sync()를 disable_delayed_work_sync()로 교체해야 합니다.
💡 쉬운 설명
Linux 커널의 암호화 통신 부분에서 여러 프로세서가 동시에 작업할 때 이미 정리된 메모리를 접근하는 버그입니다. 이로 인해 시스템이 충돌하거나 공격자가 악용할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
tls: Fix race condition in tls_sw_cancel_work_tx()
This issue was discovered during a code audit.
After cancel_delayed_work_sync() is called from tls_sk_proto_close(),
tx_work_handler() can still be scheduled from paths such as the
Delayed ACK handler or ksoftirqd.
As a result, the tx_work_handler() worker may dereference a freed
TLS object.
The following is a simple race scenario:
cpu0 cpu1
tls_sk_proto_close()
tls_sw_cancel_work_tx()
tls_write_space()
tls_sw_write_space()
if (!test_and_set_bit(BIT_TX_SCHEDULED, &tx_ctx->tx_bitmask))
set_bit(BIT_TX_SCHEDULED, &ctx->tx_bitmask);
cancel_delayed_work_sync(&ctx->tx_work.work);
schedule_delayed_work(&tx_ctx->tx_work.work, 0);
To prevent this race condition, cancel_delayed_work_sync() is
replaced with disable_delayed_work_sync().
📍 영향받는 시스템
Linux kernel (모든 최근 버전, 정확한 영향 범위는 배포판별 상이)
⚔️ 공격 벡터
Local - TLS 소켓 종료 과정에서 의도적으로 레이스 컨디션을 유발하여 메모리 오염 또는 DoS 공격 가능
🛡️ 대응 방법
Linux kernel을 최신 보안 패치가 적용된 버전으로 업데이트
🔧 검증 코드
커널 버전 확인 후 tls_sw.c에서 disable_delayed_work_sync가 사용되는 횟수를 조회하면, 0이면 미패치, 1 이상이면 패치 적용된 상태입니다.
uname -r && grep -r 'disable_delayed_work_sync' /lib/modules/$(uname -r)/ 2>/dev/null | grep -c tls_sw