🇰🇷 한글 설명
리눅스 커널의 net/sched cls_api에서 두 개의 tc 필터 추가 요청이 동시에 발생할 때 발생하는 레이스 컨디션 취약점입니다. 오류 발생 시 빈 프로토(proto) 객체가 제대로 해제되지 않고 체인에 남아 메모리 및 모듈 참조를 계속 유지하게 됩니다.
💡 쉬운 설명
네트워크 설정을 동시에 변경하려고 할 때 오류가 발생하면, 시스템 내부적으로 사용이 끝난 설정 정보가 삭제되지 않고 찌꺼기처럼 남게 됩니다. 이로 인해 시스템 자원이 계속 점유되어 메모리 누수와 유사한 문제가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net/sched: cls_api: reclaim an empty proto on the error path
Two racing tc filter add requests on the same chain/prio of an
unlocked classifier both run change() on the shared proto and both
can fail: the winner's tcf_chain_tp_delete_empty() attempt gives up
because the loser's handle is still in the idr, and the loser's
error path drops only its own reference without a second reclamation
attempt. The empty proto stays linked in the chain, holding the
chain reference, a block reference and the classifier module
reference until the chain or block is torn down.
Reclaim the proto on the error path of any failed request that holds
a proto reference. The reclamation is emptiness-gated:
tcf_chain_tp_delete_empty() unlinks the proto only when
delete_empty() admits it is empty, so a live shared proto is never
unlinked. A proto the request created is reclaimed unconditionally -
it is the only owner, so marking it for deletion is safe even without
a delete_empty callback. Classifiers without one (the check marks the
proto unconditionally) are rtnl-serialized, so the raced window this
guard closes cannot arise for them.
This is a follow-up to commit d4e359b3608a ("net/sched: cls_api: fix
teardown of an adopted proto on insert-race loss"), which stopped the
loser of the insert race from unlinking the winner's live proto but
left the empty-proto residual in place.
Conditions to recreate:
- CONFIG_NET_CLS_FLOWER=y; veth pair
- tc qdisc add dev veth0 ingress
- two concurrent `tc filter add dev veth0 ingress protocol ip pref 1
flower skip_sw ... action drop` (both fail in fl_hw_replace_filter
after publishing their handle in the idr); repeat in a loop
- an empty flower tp stays linked after both requests fail; visible
as a bare `filter protocol ip pref 1 flower chain 0` header in
`tc filter show` with no filter entries
- CAP_NET_ADMIN (namespace-local via unshare -Urn suffices)
📍 영향받는 시스템
CONFIG_NET_CLS_FLOWER가 활성화된 리눅스 커널 (veth pair 사용 환경)
⚔️ 공격 벡터
CAP_NET_ADMIN 권한을 가진 사용자가 동일한 체인에 대해 동시에 여러 개의 tc 필터 추가 요청을 반복적으로 수행
🛡️ 대응 방법
해당 취약점이 수정된 최신 리눅스 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 패치가 적용된 보안 업데이트 버전인지 확인