🇰🇷 한글 설명
Linux 커널의 DRM buddy 메모리 할당자에서 roundup_pow_of_two() 또는 round_up() 함수로 인해 할당 크기가 VRAM 최대 크기를 초과할 수 있는 취약점. 이로 인해 BUG_ON() 조건이 트리거되어 커널 패닉 발생. 패치는 할당 전 rounded size를 mm->size와 검증하는 방식으로 해결.
💡 쉬운 설명
메모리를 할당할 때 요청된 크기를 반올림하는 과정에서 전체 그래픽 메모리(VRAM) 크기를 초과하는 문제가 발생할 수 있습니다. 이 경우 시스템이 강제로 중단되는 커널 패닉이 발생합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
drm/buddy: Prevent BUG_ON by validating rounded allocation
When DRM_BUDDY_CONTIGUOUS_ALLOCATION is set, the requested size is
rounded up to the next power-of-two via roundup_pow_of_two().
Similarly, for non-contiguous allocations with large min_block_size,
the size is aligned up via round_up(). Both operations can produce a
rounded size that exceeds mm->size, which later triggers
BUG_ON(order > mm->max_order).
Example scenarios:
- 9G CONTIGUOUS allocation on 10G VRAM memory:
roundup_pow_of_two(9G) = 16G > 10G
- 9G allocation with 8G min_block_size on 10G VRAM memory:
round_up(9G, 8G) = 16G > 10G
Fix this by checking the rounded size against mm->size. For
non-contiguous or range allocations where size > mm->size is invalid,
return -EINVAL immediately. For contiguous allocations without range
restrictions, allow the request to fall through to the existing
__alloc_contig_try_harder() fallback.
This ensures invalid user input returns an error or uses the fallback
path instead of hitting BUG_ON.
v2: (Matt A)
- Add Fixes, Cc stable, and Closes tags for context
📍 영향받는 시스템
Linux kernel with DRM buddy allocator (특정 버전 미지정, 최근 버전들)
⚔️ 공격 벡터
로컬 권한을 가진 사용자가 특정 크기의 메모리 할당 요청으로 BUG_ON 조건 트리거 (예: 9G VRAM에 9G 크기의 연속 할당 요청)
🛡️ 대응 방법
커널을 최신 패치가 적용된 버전으로 업데이트 (rounded size 검증 로직 포함)
🔧 검증 코드
첫 번째 명령어로 현재 커널 버전 확인, 두 번째로 DRM buddy allocator가 활성화되어 있는지 확인. 최신 커널 버전이고 해당 설정이 없으면 패치가 적용된 것으로 판단.
uname -r && grep -i 'buddy' /boot/config-$(uname -r) 2>/dev/null || echo 'config not found'