🇰🇷 한글 설명
리눅스 커널의 netpoll 구성 요소에서 참조 횟수(refcount)를 잘못 처리하여 발생하는 취약점입니다. 특정 커밋의 오류로 인해 참조 횟수가 남아 있음에도 불구하고 데이터 구조를 조기에 초기화함으로써, 메모리 누수 및 적절한 정리 작업이 수행되지 않는 문제가 발생합니다.
💡 쉬운 설명
네트워크 장치를 정리하는 과정에서 숫자를 잘못 계산하여, 아직 사용 중인 데이터를 강제로 지워버리는 문제입니다. 이로 인해 컴퓨터의 메모리가 제대로 비워지지 않고 계속 쌓이는 현상이 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net: netpoll: fix incorrect refcount handling causing incorrect cleanup
commit efa95b01da18 ("netpoll: fix use after free") incorrectly
ignored the refcount and prematurely set dev->npinfo to NULL during
netpoll cleanup, leading to improper behavior and memory leaks.
Scenario causing lack of proper cleanup:
1) A netpoll is associated with a NIC (e.g., eth0) and netdev->npinfo is
allocated, and refcnt = 1
- Keep in mind that npinfo is shared among all netpoll instances. In
this case, there is just one.
2) Another netpoll is also associated with the same NIC and
npinfo->refcnt += 1.
- Now dev->npinfo->refcnt = 2;
- There is just one npinfo associated to the netdev.
3) When the first netpolls goes to clean up:
- The first cleanup succeeds and clears np->dev->npinfo, ignoring
refcnt.
- It basically calls `RCU_INIT_POINTER(np->dev->npinfo, NULL);`
- Set dev->npinfo = NULL, without proper cleanup
- No ->ndo_netpoll_cleanup() is either called
4) Now the second target tries to clean up
- The second cleanup fails because np->dev->npinfo is already NULL.
* In this case, ops->ndo_netpoll_cleanup() was never called, and
the skb pool is not cleaned as well (for the second netpoll
instance)
- This leaks npinfo and skbpool skbs, which is clearly reported by
kmemleak.
Revert commit efa95b01da18 ("netpoll: fix use after free") and adds
clarifying comments emphasizing that npinfo cleanup should only happen
once the refcount reaches zero, ensuring stable and correct netpoll
behavior.
📍 영향받는 시스템
리눅스 커널 (commit efa95b01da18이 적용된 버전)
⚔️ 공격 벡터
로컬 공격자가 네트워크 인터페이스의 netpoll 설정을 반복적으로 구성 및 해제하여 메모리 누수를 유도할 수 있음
🛡️ 대응 방법
문제가 된 커밋(efa95b01da18)을 되돌리고(revert), 참조 횟수가 0이 될 때만 정리가 수행되도록 커널을 업데이트해야 함
🔧 검증 코드
명령어 결과에 해당 커밋 해시가 나타나면 취약한 버전이 적용된 상태입니다.
git log -1 --format=%H | grep efa95b01da18