🇰🇷 한글 설명
Linux 커널의 accel/ethosu 드라이버에서 명령 스트림 파서가 IFM 영역 인덱스를 처리할 때 경계 검사를 제대로 수행하지 않는 취약점이 발견되었습니다. 잘못된 마스크 값 사용으로 인해 인덱스가 배열 범위를 초과하여 커널 힙 메모리를 오염시킬 수 있습니다.
💡 쉬운 설명
컴퓨터의 두뇌 역할을 하는 부품(NPU)을 제어하는 소프트웨어에 계산 오류가 있어, 잘못된 명령을 보내면 시스템의 중요한 메모리 영역을 망가뜨릴 수 있습니다. 이로 인해 시스템이 멈추거나 보안이 뚫릴 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
accel/ethosu: fix IFM region index out-of-bounds in command stream parser
NPU_SET_IFM_REGION extracts the region index with param & 0x7f, giving
a maximum value of 127. However region_size[] and output_region[] in
struct ethosu_validated_cmdstream_info are both sized to
NPU_BASEP_REGION_MAX (8), giving valid indices [0..7].
Every other region assignment in the same switch uses param & 0x7:
NPU_SET_OFM_REGION: st.ofm.region = param & 0x7;
NPU_SET_IFM2_REGION: st.ifm2.region = param & 0x7;
NPU_SET_WEIGHT_REGION: st.weight[0].region = param & 0x7;
NPU_SET_SCALE_REGION: st.scale[0].region = param & 0x7;
The 0x7f mask on IFM is inconsistent and appears to be a typo.
feat_matrix_length() and calc_sizes() use the region index directly
as an array subscript into the kzalloc'd info struct:
info->region_size[fm->region] = max(...);
A userspace caller supplying NPU_SET_IFM_REGION with param > 7 causes
a write up to 127*8 = 1016 bytes past the start of region_size[],
corrupting adjacent kernel heap data.
Fix by applying the same & 0x7 mask used by all other region
assignments.
📍 영향받는 시스템
Linux kernel (accel/ethosu driver 포함 버전)
⚔️ 공격 벡터
사용자 공간(Userspace)에서 조작된 NPU_SET_IFM_REGION 파라미터를 전달하여 커널 힙 메모리 오버플로우 유도
🛡️ 대응 방법
커널 패치를 적용하여 IFM 영역 인덱스 추출 시 마스크 값을 0x7f에서 0x7로 수정
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 수정된 최신 보안 패치 버전인지 확인합니다.