🇰🇷 한글 설명
Linux 커널의 USB gadget functionfs(f_fs) 구성 요소에서 발생하는 취약점으로, 특정 조건에서 reset_work 구조체가 초기화되지 않은 상태로 사용될 수 있습니다. 이로 인해 unmount 시 cancel_work_sync() 호출 과정에서 커널 경고(WARN_ON)가 발생하며 시스템 안정성에 영향을 줄 수 있습니다.
💡 쉬운 설명
USB 연결 기능을 관리하는 소프트웨어에서 초기화되지 않은 작업 명령을 실행하려다 오류가 발생하는 문제입니다. 이 오류로 인해 시스템에 경고 메시지가 뜨거나 예기치 않은 동작이 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: f_fs: initialize reset_work at allocation time
ffs_fs_kill_sb() unconditionally calls cancel_work_sync() on
ffs->reset_work when a functionfs instance is unmounted:
ffs_data_reset(ffs);
cancel_work_sync(&ffs->reset_work);
However ffs->reset_work is only ever initialized via INIT_WORK() in
ffs_func_set_alt() and ffs_func_disable(), and only on the
FFS_DEACTIVATED path. That state is reached solely by ffs_data_closed()
when the instance is mounted with the "no_disconnect" option, so for the
common case (no "no_disconnect", or mounted and unmounted without ever
being deactivated) reset_work is never initialized.
ffs_data_new() allocates the ffs_data with kzalloc_obj() and does not
initialize reset_work, and ffs_data_reset()/ffs_data_clear() do not touch
it either, so reset_work.func is left NULL. cancel_work_sync() on such a
work then trips the WARN_ON(!work->func) guard in __flush_work():
WARNING: kernel/workqueue.c:4301 at __flush_work+0x330/0x360, CPU#3: umount
Call trace:
__flush_work
cancel_work_sync
ffs_fs_kill_sb [usb_f_fs]
deactivate_locked_super
deactivate_super
cleanup_mnt
__cleanup_mnt
task_work_run
exit_to_user_mode_loop
el0_svc
On older kernels cancel_work_sync() on a zero-initialized work struct was
a silent no-op, which hid the missing initialization.
Initialize reset_work once in ffs_data_new() so it is always valid for
the lifetime of the ffs_data, and drop the now-redundant INIT_WORK()
calls from the two deactivation paths.
📍 영향받는 시스템
Linux kernel (USB gadget functionfs 사용 환경)
⚔️ 공격 벡터
로컬 사용자가 특정 옵션(no_disconnect)을 사용하여 functionfs를 마운트 및 언마운트하는 과정에서 트리거 가능
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 ffs_data_new() 단계에서 reset_work가 올바르게 초기화되도록 수정해야 합니다.
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 확인합니다.