🇰🇷 한글 설명
Linux 커널의 aspeed lpc-snoop 드라이버에서 kfifo 버퍼에 대한 동기화 부재로 인해 발생하는 usercopy 오버플로우 취약점입니다. SMP 시스템에서 인터럽트 핸들러와 파일 읽기 함수가 동시에 kfifo에 접근할 경우, 버퍼 크기를 초과하는 메모리 복사 시도가 발생하여 커널 버그(Kernel BUG)를 유발할 수 있습니다.
💡 쉬운 설명
컴퓨터의 데이터를 임시로 저장하는 공간(버퍼)을 여러 작업이 동시에 사용하면서 데이터가 넘쳐흐르는 문제입니다. 이로 인해 시스템이 갑자기 멈추거나 보안상 위험한 메모리 영역에 접근할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
soc: aspeed: lpc-snoop: Fix usercopy overflow in snoop_file_read
put_fifo_with_discard() acts as both producer and consumer on the kfifo:
it calls kfifo_skip() (advances out) and kfifo_put() (advances in) from
the IRQ handler without synchronizing with snoop_file_read(), which also
consumes via kfifo_to_user(). On SMP systems this concurrent access can
leave (in - out) larger than the ring buffer, so __kfifo_to_user()'s clamp
to (in - out) is ineffective and kfifo_copy_to_user() can attempt a
copy_to_user() past the kmalloc-2k backing store:
usercopy: Kernel memory exposure attempt detected from SLUB object
'kmalloc-2k' (offset 0, size 2049)!
kernel BUG at mm/usercopy.c!
Call trace:
usercopy_abort
__check_heap_object
__check_object_size
kfifo_copy_to_user
__kfifo_to_user
snoop_file_read
vfs_read
Serialize kfifo access with a per-channel spinlock shared between the
IRQ handler (producer) and the file reader (consumer). Annotate @fifo
with __guarded_by(&lock) and opt the driver into context analysis so the
compiler enforces that all fifo access holds the lock.
📍 영향받는 시스템
Aspeed LPC-snoop 드라이버를 사용하는 Linux 커널 시스템
⚔️ 공격 벡터
SMP 환경에서 인터럽트 발생과 파일 읽기 작업을 동시에 유도하여 메모리 오버플로우 유발
🛡️ 대응 방법
커널 패치를 통해 kfifo 접근 시 스핀락(spinlock)을 사용하여 동기화를 적용하고 최신 커널로 업데이트
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 확인