🇰🇷 한글 설명
Linux 커널의 nbd 드라이버에서 nbd_start_device_ioctl() 실행 중 시그널에 의해 중단될 때, recv_threads가 0이 되기를 기다리며 진행 중인 IO 완료를 기다려 태스크가 무한 대기(hung)하는 문제가 발생할 수 있습니다. 이 패치는 시그널 중단 시 큐를 셧다운뿐 아니라 비우도록 수정합니다.
💡 쉬운 설명
리눅스 커널의 네트워크 块 장치(NBD) 기능에서 특정 조건에 시그널이 끼어들면 프로세스가 영원히 멈출 수 있었습니다. 이 수정으로 중단 시 대기 중인 작업을 정리해 멈춤 현상을 막습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
nbd: Fix hung when signal interrupts nbd_start_device_ioctl()
syzbot reported hung task [1]. The following program is a simplified
version of the reproducer:
int main(void)
{
int sv[2], fd;
if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) < 0)
return 1;
if ((fd = open("/dev/nbd0", 0)) < 0)
return 1;
if (ioctl(fd, NBD_SET_SIZE_BLOCKS, 0x81) < 0)
return 1;
if (ioctl(fd, NBD_SET_SOCK, sv[0]) < 0)
return 1;
if (ioctl(fd, NBD_DO_IT) < 0)
return 1;
return 0;
}
When signal interrupt nbd_start_device_ioctl() waiting the condition
atomic_read(&config->recv_threads) == 0, the task can hung because it
waits the completion of the inflight IOs.
This patch fixes the issue by clearing queue, not just shutdown, when
signal interrupt nbd_start_device_ioctl().
📍 영향받는 시스템
패치 이전의 nbd 드라이버를 포함한 Linux 커널 (정확한 버전은 해당 커널 배포판 패키지 changelog 확인 필요)
⚔️ 공격 벡터
로컬 사용자가 /dev/nbd0에 대해 NBD 관련 ioctl을 순서대로 호출하고 시그널로 중단시켜 태스크를 교착 상태로 만드는 서비스 거부(DoS) 형태
🛡️ 대응 방법
배포판에서 제공하는 최신 커널 보안 업데이트를 적용하거나 커널을 해당 수정 커밋이 포함된 버전으로 업그레이드하고 재부팅합니다.
🔧 검증 코드
출력된 커널 버전이 배포판의 수정된 보안 업데이트 버전 이상인지 확인하고, nbd 모듈 정보와 장치 존재 여부로 해당 드라이버 사용 가능성을 판단합니다 (버전이 최신 패치 이상이면 조치 완료로 간주).
uname -r && (modinfo nbd 2>/dev/null | grep -i version); ls -l /dev/nbd0 2>/dev/null