🇰🇷 한글 설명
Linux 커널의 meson 클럭 드라이버에서 gxbb_32k_clk_sel 멀티플렉서의 부모 클럭 개수가 실제 개수와 일치하지 않아 발생하는 Out-of-bounds read 취약점입니다. 하드코딩된 부모 클럭 개수 값이 실제 배열 크기보다 크게 설정되어 있어 메모리 경계를 벗어난 읽기 작업이 발생합니다.
💡 쉬운 설명
컴퓨터의 시계 역할을 하는 부품을 설정할 때, 실제 연결된 선의 개수보다 더 많은 개수가 있다고 잘못 알려주어 발생하는 오류입니다. 이로 인해 시스템이 허용되지 않은 메모리 영역을 읽으려다 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
clk: meson: align gxbb_32k_clk_sel number of parents with actual count
The following out-of-bounds read has been observed by Christian on a
GXBB WeTek Hub:
==================================================================
BUG: KASAN: global-out-of-bounds in __clk_register+0x1b70/0x2418
Read of size 8 at addr ffffd66320cf88e0 by task swapper/0/1
CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 7.0.0-rc5 #1 PREEMPT
Hardware name: WeTek Hub (DT)
Call trace:
show_stack+0x14/0x20 (C)
dump_stack_lvl+0x74/0x94
print_report+0x164/0x4b0
kasan_report+0x98/0xd8
__asan_report_load8_noabort+0x1c/0x24
__clk_register+0x1b70/0x2418
devm_clk_hw_register+0x74/0x15c
meson_clkc_init+0xd4/0x20c
meson_clkc_syscon_probe+0x5c/0x94
platform_probe+0xbc/0x17c
really_probe+0x184/0x844
__driver_probe_device+0x154/0x35c
driver_probe_device+0x60/0x188
__driver_attach+0x168/0x4a0
bus_for_each_dev+0xec/0x180
driver_attach+0x38/0x58
bus_add_driver+0x238/0x4c0
driver_register+0x150/0x388
__platform_driver_register+0x54/0x7c
gxbb_clkc_driver_init+0x18/0x20
do_one_initcall+0xb8/0x340
kernel_init_freeable+0x49c/0x52c
kernel_init+0x24/0x148
ret_from_fork+0x10/0x20
The buggy address belongs to the variable:
gxbb_32k_clk_parents+0x60/0x400
The buggy address belongs to a vmalloc virtual mapping
The buggy address belongs to the physical page:
Memory state around the buggy address:
ffffd66320cf8780: 00 00 00 00 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9
ffffd66320cf8800: 00 04 f9 f9 f9 f9 f9 f9 00 04 f9 f9 f9 f9 f9 f9
>ffffd66320cf8880: 00 00 00 00 00 00 00 00 00 00 00 00 f9 f9 f9 f9
^
ffffd66320cf8900: 00 01 f9 f9 f9 f9 f9 f9 00 06 f9 f9 f9 f9 f9 f9
ffffd66320cf8980: 00 00 02 f9 f9 f9 f9 f9 00 00 02 f9 f9 f9 f9 f9
==================================================================
Commit 7915d7d5407c ("clk: amlogic: gxbb: drop non existing 32k clock
parent") dropped a non-existing clock parent from the gxbb_32k_clk_sel
mux but didn't adjust the hard-coded num_parents field. Fix the actual
number of parents of that mux by using ARRAY_SIZE instead (avoiding
similar problems in future).
📍 영향받는 시스템
Linux kernel (특히 WeTek Hub 등 GXBB 하드웨어를 사용하는 시스템)
⚔️ 공격 벡터
로컬 공격자가 커널 메모리 정보를 탈취하거나 시스템 불안정성을 유발할 수 있는 로컬 공격 벡터
🛡️ 대응 방법
커널 패치(Commit 7915d7d5407c)를 적용하여 클럭 부모 개수를 ARRAY_SIZE를 통해 동적으로 계산하도록 업데이트
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 패치 버전(7.0.0-rc5 이후의 수정 버전)인지 확인