🇰🇷 한글 설명
Linux 커널의 RISC-V 아키텍처에서 vmemmap 가상 주소 계산 시 경계 외 참조(Out-of-bound) 문제가 발생할 수 있는 취약점입니다. 물리 메모리 시작 주소와 실제 섹션 시작 주소 간의 차이로 인해 vmemmap 시작 지점보다 낮은 주소가 계산되어 메모리 오류를 유발할 수 있습니다.
💡 쉬운 설명
컴퓨터 메모리 주소를 계산하는 과정에서 실제 위치보다 더 앞쪽의 잘못된 주소를 가리키게 되는 오류입니다. 이로 인해 시스템이 예상치 못한 메모리 영역을 건드려 불안정해지거나 오류가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
riscv: mm: Fix the out of bound issue of vmemmap address
In sparse vmemmap model, the virtual address of vmemmap is calculated as:
((struct page *)VMEMMAP_START - (phys_ram_base >> PAGE_SHIFT)).
And the struct page's va can be calculated with an offset:
(vmemmap + (pfn)).
However, when initializing struct pages, kernel actually starts from the
first page from the same section that phys_ram_base belongs to. If the
first page's physical address is not (phys_ram_base >> PAGE_SHIFT), then
we get an va below VMEMMAP_START when calculating va for it's struct page.
For example, if phys_ram_base starts from 0x82000000 with pfn 0x82000, the
first page in the same section is actually pfn 0x80000. During
init_unavailable_range(), we will initialize struct page for pfn 0x80000
with virtual address ((struct page *)VMEMMAP_START - 0x2000), which is
below VMEMMAP_START as well as PCI_IO_END.
This commit fixes this bug by introducing a new variable
'vmemmap_start_pfn' which is aligned with memory section size and using
it to calculate vmemmap address instead of phys_ram_base.
📍 영향받는 시스템
RISC-V 아키텍처를 사용하는 Linux 커널 시스템
⚔️ 공격 벡터
특정 물리 메모리 구성 환경에서 커널 초기화 과정 중 메모리 주소 계산 오류를 유도
🛡️ 대응 방법
vmemmap_start_pfn 변수를 도입하여 메모리 섹션 크기에 맞춰 주소를 계산하도록 수정된 최신 커널로 업데이트
🔧 검증 코드
출력 결과에 riscv가 포함되어 있는지 확인하여 해당 아키텍처 사용 여부를 판단합니다.