🇰🇷 한글 설명
Linux 커널의 sched/isolation 기능에서 메모리 맵이 완전히 초기화되기 전에 memblock 할당 메모리를 해제하여 경고가 발생하는 취약점입니다. 이를 해결하기 위해 cpumask 메모리 해제 시점을 initcall 단계로 지연시키는 수정이 적용되었습니다.
💡 쉬운 설명
컴퓨터가 켜지는 아주 초기 단계에서 아직 준비되지 않은 메모리를 미리 정리하려고 시도하여 오류가 발생하는 문제입니다. 메모리 정리 순서를 뒤로 미룸으로써 시스템이 안정적으로 부팅되도록 수정되었습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
sched/isolation: Defer freeing of cpumask memblock memory to initcall
When testing a linux-next kernel with commit 59bd1d914bb5 ("memblock:
warn when freeing reserved memory before memory map is initialized"),
the following warning was hit when there was a "nohz_full" kernel boot
parameter.
Cannot free reserved memory because of deferred initialization of the memory map
WARNING: mm/memblock.c:904 at __free_reserved_area+0xde/0xf0, CPU#0: swapper/0/0
:
Call Trace:
<TASK>
memblock_phys_free+0xcb/0x100
housekeeping_init+0x14c/0x170
start_kernel+0x207/0x450
x86_64_start_reservations+0x24/0x30
x86_64_start_kernel+0xda/0xe0
common_startup_64+0x13e/0x141
</TASK>
IOW, we shouldn't free memblock allocated memory so early
in the boot process when memory map isn't fully initialized in
deferred_init_memmap().
Fix it by saving the housekeeping cpumask memblock memory to be
freed into a llist free list in housekeeping_init() and add a new
housekeeping_late_init() helper to defer the actual freeing of memblock
memory to when initcall's are being processed. The cpumask memblock
memory is treated as a llist_node with the size of a "long" type which
is also smallest cpumask size that can be allocated.
The non-atomic version of the llist APIs are used as there is no
contention.
This commit depends on the presence of commit 7c2eee9c1367 ("memblock:
don't touch memblock arrays when memblock_free() is called late")
to prevent a KASAN UAF bug report [1].
[1] https://lore.kernel.org/lkml/
[email protected]/
📍 영향받는 시스템
Linux kernel (nohz_full 파라미터를 사용하는 특정 커널 버전)
⚔️ 공격 벡터
로컬 시스템 부팅 과정에서의 커널 경고 및 잠재적 불안정성 유발 (직접적인 원격 공격 불가)
🛡️ 대응 방법
해당 수정 사항(commit 59bd1d914bb5 및 7c2eee9c1367)이 포함된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 패치가 적용된 최신 버전인지 확인합니다.