🇰🇷 한글 설명
Linux 커널 serial/core 드라이버에서 uart_write_room()과 uart_write()의 동작 불일치로 인해 PORT_UNKNOWN 포트 사용 시 무한 루프 발생. xmit_buf가 NULL일 때 uart_write_room()은 양수를 반환하지만 uart_write()는 0을 반환해서 드라이버의 쓰기 루프가 영구적으로 차단됨.
💡 쉬운 설명
직렬 포트 드라이버가 데이터를 쓸 수 있다고 잘못 판단하여 무한 루프에 빠져 시스템이 응답하지 않는 문제입니다. 특히 초기화되지 않은 직렬 포트에서 발생합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
serial: core: fix infinite loop in handle_tx() for PORT_UNKNOWN
uart_write_room() and uart_write() behave inconsistently when
xmit_buf is NULL (which happens for PORT_UNKNOWN ports that were
never properly initialized):
- uart_write_room() returns kfifo_avail() which can be > 0
- uart_write() checks xmit_buf and returns 0 if NULL
This inconsistency causes an infinite loop in drivers that rely on
tty_write_room() to determine if they can write:
while (tty_write_room(tty) > 0) {
written = tty->ops->write(...);
// written is always 0, loop never exits
}
For example, caif_serial's handle_tx() enters an infinite loop when
used with PORT_UNKNOWN serial ports, causing system hangs.
Fix by making uart_write_room() also check xmit_buf and return 0 if
it's NULL, consistent with uart_write().
Reproducer: https://gist.github.com/mrpre/d9a694cc0e19828ee3bc3b37983fde13
📍 영향받는 시스템
Linux 커널 serial/core 모듈 사용하는 모든 배포판 (caif_serial 등 직렬 포트 드라이버)
⚔️ 공격 벡터
로컬 공격자가 PORT_UNKNOWN 직렬 포트 설정/사용을 통해 시스템 DoS 유발 (커널 응답 중단)
🛡️ 대응 방법
Linux 커널 패치 적용 또는 uart_write_room() 함수에서 xmit_buf NULL 체크 추가하여 0 반환하도록 수정
🔧 검증 코드
커널 버전이 CVE 패치를 포함한 버전인지 확인하고, serial core 드라이버의 xmit_buf NULL 체크 로직 존재 여부 확인
grep -r 'uart_write_room\|xmit_buf' /sys/kernel/debug/kmesg 2>/dev/null || uname -r | grep -E '[0-9]+\.[0-9]+' && cat /proc/version | grep -oE 'Linux version [^ ]*'