🇰🇷 한글 설명
Linux 커널의 iavf(Intel 가상 기능) 드라이버에서 crit lock을 제거하고 netdev lock으로 대체한 패치입니다. 이로써 try_lock 기반의 오류 가능성 높은 잠금 로직이 제거되고, 작업 취소 시 발생하던 교착 상태(deadlock)가 해결됩니다.
💡 쉬운 설명
가상 네트워크 장치 드라이버에서 잠금(lock) 방식에 문제가 있어 작업이 서로 기다리며 멈출 수 있었습니다. 이 수정은 잠금 구조를 단순화해 그런 멈춤 현상을 없앱니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
iavf: get rid of the crit lock
Get rid of the crit lock.
That frees us from the error prone logic of try_locks.
Thanks to netdev_lock() by Jakub it is now easy, and in most cases we were
protected by it already - replace crit lock by netdev lock when it was not
the case.
Lockdep reports that we should cancel the work under crit_lock [splat1],
and that was the scheme we have mostly followed since [1] by Slawomir.
But when that is done we still got into deadlocks [splat2]. So instead
we should look at the bigger problem, namely "weird locking/scheduling"
of the iavf. The first step to fix that is to remove the crit lock.
I will followup with a -next series that simplifies scheduling/tasks.
Cancel the work without netdev lock (weird unlock+lock scheme),
to fix the [splat2] (which would be totally ugly if we would kept
the crit lock).
Extend protected part of iavf_watchdog_task() to include scheduling
more work.
Note that the removed comment in iavf_reset_task() was misplaced,
it belonged to inside of the removed if condition, so it's gone now.
[splat1] - w/o this patch - The deadlock during VF removal:
WARNING: possible circular locking dependency detected
sh/3825 is trying to acquire lock:
((work_completion)(&(&adapter->watchdog_task)->work)){+.+.}-{0:0}, at: start_flush_work+0x1a1/0x470
but task is already holding lock:
(&adapter->crit_lock){+.+.}-{4:4}, at: iavf_remove+0xd1/0x690 [iavf]
which lock already depends on the new lock.
[splat2] - when cancelling work under crit lock, w/o this series,
see [2] for the band aid attempt
WARNING: possible circular locking dependency detected
sh/3550 is trying to acquire lock:
((wq_completion)iavf){+.+.}-{0:0}, at: touch_wq_lockdep_map+0x26/0x90
but task is already holding lock:
(&dev->lock){+.+.}-{4:4}, at: iavf_remove+0xa6/0x6e0 [iavf]
which lock already depends on the new lock.
[1] fc2e6b3b132a ("iavf: Rework mutexes for better synchronisation")
[2] https://github.com/pkitszel/linux/commit/52dddbfc2bb60294083f5711a158a
📍 영향받는 시스템
Intel iavf 드라이버를 사용하는 Linux 커널 (수정 이전 버전)
⚔️ 공격 벡터
로컬 사용자가 VF 제거 등 드라이버 작업을 유발해 커널 교착 상태(서비스 거부)를 일으킬 수 있음
🛡️ 대응 방법
배포판 제공 최신 Linux 커널 업데이트를 설치하고 재부팅
🔧 검증 코드
커널 버전이 이 패치가 포함된 배포판 업데이트 이후인지 확인하고, iavf 모듈이 없으면 해당 드라이버를 사용하지 않는 것이므로 영향 없음
uname -r && (modinfo iavf 2>/dev/null | grep -E '^(version|srcversion|filename)')