🇰🇷 한글 설명
Linux 커널의 idpf 드라이버에서 비동기 VC(Virtchnl) 처리 시 PREEMPT_RT 환경에 맞지 않게 raw 스핀락과 BH 스핀락이 중첩되어 'Invalid wait context' 경고가 발생하는 문제입니다. 해결책으로 completion의 raw 스핀락 대신 idpf_vc_xn 구조체에 로컬 락을 사용하도록 변경했습니다.
💡 쉬운 설명
인텔 IPU/SmartNIC 계열 네트워크 드라이버가 실시간 커널 모드에서 잠금 순서를 잘못 사용해 커널이 경고를 출력하는 문제입니다. 보안 침해보다는 안정성과 디버깅 관련 결함에 가깝습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
idpf: fix PREEMPT_RT raw/bh spinlock nesting for async VC handling
Switch from using the completion's raw spinlock to a local lock in the
idpf_vc_xn struct. The conversion is safe because complete/_all() are
called outside the lock and there is no reason to share the completion
lock in the current logic. This avoids invalid wait context reported by
the kernel due to the async handler taking BH spinlock:
[ 805.726977] =============================
[ 805.726991] [ BUG: Invalid wait context ]
[ 805.727006] 7.0.0-rc2-net-devq-031026+ #28 Tainted: G S OE
[ 805.727026] -----------------------------
[ 805.727038] kworker/u261:0/572 is trying to lock:
[ 805.727051] ff190da6a8dbb6a0 (&vport_config->mac_filter_list_lock){+...}-{3:3}, at: idpf_mac_filter_async_handler+0xe9/0x260 [idpf]
[ 805.727099] other info that might help us debug this:
[ 805.727111] context-{5:5}
[ 805.727119] 3 locks held by kworker/u261:0/572:
[ 805.727132] #0: ff190da6db3e6148 ((wq_completion)idpf-0000:83:00.0-mbx){+.+.}-{0:0}, at: process_one_work+0x4b5/0x730
[ 805.727163] #1: ff3c6f0a6131fe50 ((work_completion)(&(&adapter->mbx_task)->work)){+.+.}-{0:0}, at: process_one_work+0x1e5/0x730
[ 805.727191] #2: ff190da765190020 (&x->wait#34){+.+.}-{2:2}, at: idpf_recv_mb_msg+0xc8/0x710 [idpf]
[ 805.727218] stack backtrace:
...
[ 805.727238] Workqueue: idpf-0000:83:00.0-mbx idpf_mbx_task [idpf]
[ 805.727247] Call Trace:
[ 805.727249] <TASK>
[ 805.727251] dump_stack_lvl+0x77/0xb0
[ 805.727259] __lock_acquire+0xb3b/0x2290
[ 805.727268] ? __irq_work_queue_local+0x59/0x130
[ 805.727275] lock_acquire+0xc6/0x2f0
[ 805.727277] ? idpf_mac_filter_async_handler+0xe9/0x260 [idpf]
[ 805.727284] ? _printk+0x5b/0x80
[ 805.727290] _raw_spin_lock_bh+0x38/0x50
[ 805.727298] ? idpf_mac_filter_async_handler+0xe9/0x260 [idpf]
[ 805.727303] idpf_mac_filter_async_handler+0xe9/0x260 [idpf]
[ 805.727310] idpf_recv_mb_msg+0x1c8/0x710 [idpf]
[ 805.727317] process_one_work+0x226/0x730
[ 805.727322] worker_thread+0x19e/0x340
[ 805.727325] ? __pfx_worker_thread+0x10/0x10
[ 805.727328] kthread+0xf4/0x130
[ 805.727333] ? __pfx_kthread+0x10/0x10
[ 805.727336] ret_from_fork+0x32c/0x410
[ 805.727345] ? __pfx_kthread+0x10/0x10
[ 805.727347] ret_from_fork_asm+0x1a/0x30
[ 805.727354] </TASK>
📍 영향받는 시스템
idpf 네트워크 드라이버를 사용하는 PREEMPT_RT 설정의 Linux 커널 (7.0.0-rc2 등 수정 전 버전)
⚔️ 공격 벡터
네트워크 공격 경로가 명확하지 않으며, 로컬 환경에서 드라이버 비동기 처리 경로가 실행될 때 잠금 컨텍스트 경고가 발생하는 결함입니다.
🛡️ 대응 방법
패치가 적용된 상위 Linux 커널 버전으로 업데이트하거나 배포판 보안 업데이트를 설치하십시오.
🔧 검증 코드
커널 버전이 패치 적용 버전 이전인지, idpf 모듈 로드 여부, PREEMPT_RT 설정 여부를 확인하여 세 조건이 모두 해당하면 취약 가능성이 있으므로 배포판 업데이트를 적용하십시오.
uname -r && (lsmod | grep -w idpf || echo 'idpf 모듈 미로드') && (grep -i PREEMPT_RT /boot/config-$(uname -r) 2>/dev/null || echo 'config 확인 불가')