🇰🇷 한글 설명
Linux 커널의 ATM 드라이버(fore200e)에서 PCA-200E/SBA-200E 어댑터 제거 시 tasklet이 완전히 종료되지 않아 이미 해제된 메모리에 접근하는 use-after-free 취약점이 발생합니다. 디바이스 제거 중에도 tasklet이 실행 중이면 해제된 fore200e 구조체에 접근하여 메모리 손상을 야기합니다. fore200e_shutdown()에 tasklet_kill()을 추가하여 tasklet을 완전히 중지시킬 때 수정됩니다.
💡 쉬운 설명
어댑터를 제거할 때 여전히 실행 중인 프로그램이 이미 없어진 메모리에 접근하려고 시도하는 문제입니다. 이는 시스템 충돌이나 데이터 손상을 유발할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
atm: fore200e: fix use-after-free in tasklets during device removal
When the PCA-200E or SBA-200E adapter is being detached, the fore200e
is deallocated. However, the tx_tasklet or rx_tasklet may still be running
or pending, leading to use-after-free bug when the already freed fore200e
is accessed again in fore200e_tx_tasklet() or fore200e_rx_tasklet().
One of the race conditions can occur as follows:
CPU 0 (cleanup) | CPU 1 (tasklet)
fore200e_pca_remove_one() | fore200e_interrupt()
fore200e_shutdown() | tasklet_schedule()
kfree(fore200e) | fore200e_tx_tasklet()
| fore200e-> // UAF
Fix this by ensuring tx_tasklet or rx_tasklet is properly canceled before
the fore200e is released. Add tasklet_kill() in fore200e_shutdown() to
synchronize with any pending or running tasklets. Moreover, since
fore200e_reset() could prevent further interrupts or data transfers,
the tasklet_kill() should be placed after fore200e_reset() to prevent
the tasklet from being rescheduled in fore200e_interrupt(). Finally,
it only needs to do tasklet_kill() when the fore200e state is greater
than or equal to FORE200E_STATE_IRQ, since tasklets are uninitialized
in earlier states. In a word, the tasklet_kill() should be placed in
the FORE200E_STATE_IRQ branch within the switch...case structure.
This bug was identified through static analysis.
📍 영향받는 시스템
Linux kernel with fore200e ATM driver for PCA-200E and SBA-200E network adapters
⚔️ 공격 벡터
Local privilege required with physical access to remove or hot-plug the network adapter during system runtime
🛡️ 대응 방법
Apply kernel patch adding tasklet_kill() in fore200e_shutdown() before memory deallocation to properly synchronize and cancel pending tasklets
🔧 검증 코드
패치된 버전은 fore200e_shutdown() 함수 내에 tasklet_kill() 호출이 있어야 하며, 없으면 취약한 상태입니다.
grep -A10 'void fore200e_shutdown' /usr/src/linux/drivers/atm/fore200e.c 2>/dev/null | grep -q 'tasklet_kill' && echo 'patched' || echo 'vulnerable'