🇰🇷 한글 설명
Linux kernel의 macb 네트워크 드라이버에서 transmit ring 초기화 시 이미 queued된 패킷이 손실되고 tx_head/tx_tail의 동시 접근으로 transmission이 stuck되는 버그입니다. 이로 인해 AMD Zynq 보드의 NFS rootfs 복구 시간이 크게 지연됩니다.
💡 쉬운 설명
네트워크 드라이버가 데이터 전송 대기열을 초기화할 때 이미 보낸 데이터가 손실되고 새 데이터 전송이 멈추는 문제입니다. 특히 절전 후 네트워크 복구가 매우 오래 걸립니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net: macb: Shuffle the tx ring before enabling tx
Quanyang observed that when using an NFS rootfs on an AMD ZynqMp board,
the rootfs may take an extended time to recover after a suspend.
Upon investigation, it was determined that the issue originates from a
problem in the macb driver.
According to the Zynq UltraScale TRM [1], when transmit is disabled,
the transmit buffer queue pointer resets to point to the address
specified by the transmit buffer queue base address register.
In the current implementation, the code merely resets `queue->tx_head`
and `queue->tx_tail` to '0'. This approach presents several issues:
- Packets already queued in the tx ring are silently lost,
leading to memory leaks since the associated skbs cannot be released.
- Concurrent write access to `queue->tx_head` and `queue->tx_tail` may
occur from `macb_tx_poll()` or `macb_start_xmit()` when these values
are reset to '0'.
- The transmission may become stuck on a packet that has already been sent
out, with its 'TX_USED' bit set, but has not yet been processed. However,
due to the manipulation of 'queue->tx_head' and 'queue->tx_tail',
`macb_tx_poll()` incorrectly assumes there are no packets to handle
because `queue->tx_head == queue->tx_tail`. This issue is only resolved
when a new packet is placed at this position. This is the root cause of
the prolonged recovery time observed for the NFS root filesystem.
To resolve this issue, shuffle the tx ring and tx skb array so that
the first unsent packet is positioned at the start of the tx ring.
Additionally, ensure that updates to `queue->tx_head` and
`queue->tx_tail` are properly protected with the appropriate lock.
[1] https://docs.amd.com/v/u/en-US/ug1085-zynq-ultrascale-trm
📍 영향받는 시스템
Linux kernel macb driver (AMD Zynq UltraScale, Zynq MP 보드) - 패치 이전 모든 버전
⚔️ 공격 벡터
Suspend/resume 이벤트 또는 네트워크 재설정을 통한 네트워크 서비스 거부 (DoS)
🛡️ 대응 방법
영향받는 kernel을 패치된 버전으로 업그레이드하거나 macb driver transmit ring shuffle 패치 적용
🔧 검증 코드
dmesg에서 macb 드라이버 로드 여부와 Zynq 보드 확인, kernel 버전 확인 후 보안 업데이트 필요 여부 판단
dmesg | grep -E 'macb|Zynq' && uname -r