🇰🇷 한글 설명
Linux 커널의 mlx5 vdpa 드라이버에서 create_direct_keys() 함수가 버퍼 길이를 잘못 계산하여 발생하는 slab-out-of-bounds 취약점입니다. 이로 인해 명령 데이터를 복사할 때 할당된 버퍼 범위를 초과하여 읽는 메모리 오버런이 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터 메모리에 데이터를 담을 그릇을 만들 때, 실제 그릇 크기보다 더 많은 양을 읽으려고 시도하여 발생하는 오류입니다. 이로 인해 시스템이 멈추거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
vdpa/mlx5: Fix buffer length in create_direct_keys()
We have seen in our CI the following KASAN message:
BUG: KASAN: slab-out-of-bounds in cmd_exec+0x550/0xca0 [mlx5_core]
Read of size 272 at addr 0000000176795020 by task qemu-system-s39/82764
[...]
[<000011388ab3a7a0>] cmd_exec+0x550/0xca0 [mlx5_core]
[<000011388ab3b61c>] mlx5_cmd_exec_cb+0x25c/0x4f0 [mlx5_core]
[<000011388b21e82e>] mlx5_vdpa_exec_async_cmds+0x22e/0x5e0 [mlx5_vdpa]
[<000011388b21fd44>] create_direct_keys+0x954/0xef0 [mlx5_vdpa]
[...]
The buggy address is located 4128 bytes inside of
allocated 4384-byte region [0000000176794000, 0000000176795120)
So in essence we read 16 bytes beyond 4384-byte allocation.
create_direct_keys calculates the pointer and length for in and out
buffers.
The size calculation for in includes the entire structure
size (out + in + mtt[]) but the pointer passed to cmd_exec points only
to the 'in' field, skipping the 'out' field.
This causes mlx5_copy_to_msg() to read beyond the allocated buffer
by sizeof(out) bytes when copying command data.
Properly calculate the input size to match the pointer and allocation size.
📍 영향받는 시스템
Linux kernel (mlx5_core 및 mlx5_vdpa 드라이버를 사용하는 시스템)
⚔️ 공격 벡터
QEMU와 같은 가상화 환경에서 악의적으로 조작된 명령을 통해 드라이버의 메모리 경계를 초과하여 읽도록 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 버퍼 크기 계산 로직을 수정해야 합니다.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인합니다.