🇰🇷 한글 설명
Linux 커널 net/mlx5 드라이버에서 devlink 락과 esw->wq 간의 교착 상태 발생. eswitch 모드 변경 시 워크큐 플러시가 이벤트 핸들러와 교착 상태를 일으킴. 생성 카운터를 사용하여 오래된 핸들러의 영향을 방지하는 방식으로 수정.
💡 쉬운 설명
리눅스 커널의 Mellanox 네트워크 드라이버에서 두 개의 락이 서로를 기다리면서 시스템이 응답 불가 상태가 되는 문제입니다. 작업 추적 카운터 방식으로 변경하여 교착 상태를 제거했습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
net/mlx5: Fix deadlock between devlink lock and esw->wq
esw->work_queue executes esw_functions_changed_event_handler ->
esw_vfs_changed_event_handler and acquires the devlink lock.
.eswitch_mode_set (acquires devlink lock in devlink_nl_pre_doit) ->
mlx5_devlink_eswitch_mode_set -> mlx5_eswitch_disable_locked ->
mlx5_eswitch_event_handler_unregister -> flush_workqueue deadlocks
when esw_vfs_changed_event_handler executes.
Fix that by no longer flushing the work to avoid the deadlock, and using
a generation counter to keep track of work relevance. This avoids an old
handler manipulating an esw that has undergone one or more mode changes:
- the counter is incremented in mlx5_eswitch_event_handler_unregister.
- the counter is read and passed to the ephemeral mlx5_host_work struct.
- the work handler takes the devlink lock and bails out if the current
generation is different than the one it was scheduled to operate on.
- mlx5_eswitch_cleanup does the final draining before destroying the wq.
No longer flushing the workqueue has the side effect of maybe no longer
cancelling pending vport_change_handler work items, but that's ok since
those are disabled elsewhere:
- mlx5_eswitch_disable_locked disables the vport eq notifier.
- mlx5_esw_vport_disable disarms the HW EQ notification and marks
vport->enabled under state_lock to false to prevent pending vport
handler from doing anything.
- mlx5_eswitch_cleanup destroys the workqueue and makes sure all events
are disabled/finished.
📍 영향받는 시스템
Linux kernel with Mellanox MLX5 Ethernet driver (eswitch mode support)
⚔️ 공격 벡터
시스템 관리자가 eswitch 모드를 변경할 때 커널 panic 또는 시스템 응답 불가 유발
🛡️ 대응 방법
최신 안정 버전의 Linux 커널로 업데이트 (CVE 수정 커밋 포함 버전)
🔧 검증 코드
MLX5_CORE가 활성화되어 있으면 해당 드라이버가 적용되어 있음을 확인. 최신 커널로 업데이트 후 eswitch 모드 변경 테스트 시 시스템이 응답 불가가 되지 않으면 수정 완료.
grep -i mlx5 /boot/config-$(uname -r) && echo 'MLX5 driver enabled' || echo 'MLX5 driver not found'