🇰🇷 한글 설명
Linux 커널의 xfrm 모듈에서 네트워크 네임스페이스 종료 시 RCU 동기화 함수를 잘못된 위치에서 호출하여 발생하는 성능 저하 및 자원 고갈 취약점입니다. 기존의 .exit 핸들러에서 호출되던 synchronize_rcu()를 .pre_exit와 .exit로 분리하여, 다수의 네임스페이스 삭제 시 발생하는 직렬적인 대기 시간을 최적화함으로써 시스템 중단을 방지합니다.
💡 쉬운 설명
네트워크 설정을 삭제할 때 컴퓨터가 너무 오랫동안 기다리게 만들어 시스템이 멈추거나 메모리가 부족해지는 문제입니다. 이를 해결하기 위해 삭제 순서를 효율적으로 바꾸어 컴퓨터가 빠르게 작업을 마칠 수 있도록 수정했습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
xfrm: move policy_bydst RCU sync from per-netns .exit to .pre_exit
The struct pernet_operations docstring in include/net/net_namespace.h
explicitly warns against blocking RCU primitives in .exit handlers:
Exit methods using blocking RCU primitives, such as
synchronize_rcu(), should be implemented via exit_batch.
[...]
Please, avoid synchronize_rcu() at all, where it's possible.
Note that a combination of pre_exit() and exit() can
be used, since a synchronize_rcu() is guaranteed between
the calls.
xfrm_policy_fini() violates this: it calls synchronize_rcu() before
freeing the policy_bydst hash tables (so no RCU reader is mid-
traversal at free time), but runs from xfrm_net_ops.exit -- once per
namespace -- so a cleanup_net() of N namespaces pays N full RCU
grace periods serially.
Use the documented pre_exit/exit split. Move the policy flush (and
the workqueue drains it depends on) into a new .pre_exit handler;
xfrm_policy_fini() then runs in .exit and frees the hash tables
after the synchronize_rcu_expedited() that cleanup_net() guarantees
between the two phases. Providing O(1) RCU grace periods per batch
instead of O(N).
Observed on Linux 6.18 with a workload doing unshare(CLONE_NEWNET)
at ~13/sec sustained: cleanup_net() and the netns_wq rescuer kthread
both stuck in xfrm_policy_fini()'s synchronize_rcu(), >300k struct
net accumulated in the cleanup queue, Percpu in /proc/meminfo climbed
to 130+ GB on 256-CPU hosts, and memcg OOMs followed. setup_net and
__put_net counts were balanced, ruling out a refcount leak.
📍 영향받는 시스템
Linux kernel (specifically versions including 6.18 and affected xfrm implementation)
⚔️ 공격 벡터
Local (사용자가 지속적으로 네트워크 네임스페이스를 생성하고 삭제하여 시스템 자원을 고갈시키는 방식)
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인하십시오.