🇰🇷 한글 설명
Linux 커널의 iommufd 구성 요소에서 veventq 읽기 작업 시 헤더 크기 계산 오류가 발견되었습니다. 포인터 크기를 사용하여 헤더 크기를 잘못 계산함으로써, 32비트 시스템에서 사용자 버퍼 범위를 초과하여 데이터를 쓰는 버퍼 오버플로우 취약점이 발생할 수 있습니다.
💡 쉬운 설명
데이터를 읽어올 때 크기를 확인하는 과정에서 실수로 데이터 자체가 아닌 '데이터의 위치 정보' 크기를 사용하여 검사했습니다. 이로 인해 실제 데이터보다 더 많은 양이 메모리에 써지면서 시스템 오류나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
iommufd: Use sizeof(*hdr) instead of sizeof(hdr) in veventq read
The bound-check in iommufd_veventq_fops_read() for the normal vEVENT
path uses sizeof(hdr) where the surrounding code uses sizeof(*hdr):
if (!vevent_for_lost_events_header(cur) &&
sizeof(hdr) + cur->data_len > count - done) {
hdr is declared as struct iommufd_vevent_header *, so sizeof(hdr)
evaluates to the size of the pointer. Surrounding code uses
sizeof(*hdr) consistently:
if (done >= count || sizeof(*hdr) > count - done) {
...
if (copy_to_user(buf + done, hdr, sizeof(*hdr))) {
...
done += sizeof(*hdr);
struct iommufd_vevent_header is currently 8 bytes (two __u32 fields,
flags and sequence), so on 64-bit (sizeof(void *) == 8) the two
expressions happen to be equal and the check works as intended.
On 32-bit (sizeof(void *) == 4) the check under-counts the header by
4 bytes: a vEVENT whose data_len causes 8 + cur->data_len to exceed
count - done while 4 + cur->data_len does not will pass the check,
then the loop will copy_to_user 8 bytes of header followed by data_len
bytes of payload, writing past the user-supplied buffer.
It is also a latent bug for any future expansion of struct
iommufd_vevent_header beyond sizeof(void *) on 64-bit; the check
should not depend on the type happening to match the host pointer
width.
Use sizeof(*hdr) to match the rest of the function and the actual
amount that will be copied.
📍 영향받는 시스템
iommufd를 사용하는 32비트 Linux 커널 시스템
⚔️ 공격 벡터
조작된 vEVENT 데이터를 통해 사용자 공간 버퍼의 경계를 넘어서는 메모리 쓰기 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 iommufd의 sizeof 연산 오류를 수정해야 합니다.
🔧 검증 코드
커널 버전과 iommufd 설정 활성화 여부를 확인하고, 배포된 보안 패치 내역을 통해 해당 CVE 수정 여부를 대조합니다.
uname -a && grep -i 'iommufd' /proc/config.gz 2>/dev/null || zgrep -i 'CONFIG_IOMMUFD' /proc/config.gz