🇰🇷 한글 설명
Linux 커널의 UP(Uniprocessor) 환경에서 NMI(Non-Maskable Interrupt) 컨텍스트 내 kmalloc_nolock() 호출 시 발생하는 취약점입니다. spin_trylock()이 항상 성공하는 특성으로 인해 슬랩 할당자의 락을 중복 획득하여 슬랩 상태를 손상시킬 수 있습니다.
💡 쉬운 설명
컴퓨터의 핵심 운영체제인 리눅스에서 특정 상황에 메모리를 할당하려 할 때, 데이터 관리 규칙이 깨져 시스템이 고장 날 수 있는 문제입니다. 이로 인해 시스템이 갑자기 멈추거나 데이터가 손상될 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm/slab: return NULL early from kmalloc_nolock() in NMI on UP
On UP kernels (!CONFIG_SMP), spin_trylock() is a no-op that
unconditionally succeeds even when the lock is already held. As a
result, kmalloc_nolock() called from NMI context can re-enter the slab
allocator and acquire n->list_lock that the interrupted context is
already holding, corrupting slab state.
With CONFIG_DEBUG_SPINLOCK on UP, the following BUG is triggered with
the slub_kunit test module:
BUG: spinlock trylock failure on UP on CPU#0, kunit_try_catch/243
[...]
Call Trace:
<NMI>
dump_stack_lvl+0x3f/0x60
do_raw_spin_trylock+0x41/0x50
_raw_spin_trylock+0x24/0x50
get_from_partial_node+0x120/0x4d0
___slab_alloc+0x8a/0x4c0
kmalloc_nolock_noprof+0x164/0x310
[...]
</NMI>
Fix this by returning NULL early when invoked from NMI on a UP kernel.
📍 영향받는 시스템
CONFIG_SMP가 설정되지 않은(UP 커널) Linux kernel
⚔️ 공격 벡터
NMI 컨텍스트를 유도하여 슬랩 할당자의 내부 상태를 손상시키는 방식
🛡️ 대응 방법
NMI 컨텍스트에서 kmalloc_nolock() 호출 시 NULL을 조기에 반환하도록 커널 패치 적용
🔧 검증 코드
출력 결과에서 CONFIG_SMP가 정의되지 않았고(UP 커널), 커널 버전이 패치된 버전인지 확인합니다.
uname -a && grep -E 'CONFIG_SMP|CONFIG_DEBUG_SPINLOCK' /boot/config-$(uname -r)