🇰🇷 한글 설명
Linux 커널의 hwmon(coretemp) 드라이버에서 PTS(Package Thermal Support)를 지원하지 않는 CPU 사용 시 core_data 메모리가 해제되지 않는 메모리 누수 취약점이 발견되었습니다. 패키지 데이터가 생성되지 않아 destroy_temp_data() 함수가 호출되지 않음으로써 발생하는 문제로, 이를 해결하기 위해 coretemp_device_remove()에서 해당 배열을 명시적으로 해제하도록 수정되었습니다.
💡 쉬운 설명
특정 CPU 환경에서 컴퓨터의 온도를 측정하는 기능이 작동할 때, 사용이 끝난 메모리를 제대로 비워주지 않아 메모리가 계속 쌓이는 문제가 있었습니다. 이로 인해 시스템의 메모리가 점진적으로 부족해질 수 있는 현상입니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
hwmon: (coretemp) Fix core_data leak on CPUs without PTS
pdata->core_data is allocated in init_temp_data() when the first core
temp_data of a package is created, but it is only released from
destroy_temp_data(), and only in the branch that handles the package
temp_data.
Package temp_data is created solely when the CPU supports
X86_FEATURE_PTS. On a CPU without it, coretemp_cpu_online() never calls
coretemp_add_core() with pkg_flag set, so pdata->pkg_data stays NULL.
coretemp_cpu_offline() then skips the removal of the package interface,
destroy_temp_data() is never called for package data, and the array is
still allocated when coretemp_device_remove() frees the platform data
that pointed at it.
Release the array in coretemp_device_remove(). destroy_temp_data() sets
pdata->core_data to NULL when it frees it, so the added kfree() is a
no-op on CPUs that do have PTS.
Tested on an Intel Core i5-1135G7. The driver was instrumented to log
every allocation and release of pdata->core_data, and the PTS check in
coretemp_cpu_online() was patched out to emulate a CPU without package
thermal support. Without this change the array was allocated and never
released, and coretemp_device_remove() still saw a non-NULL pointer.
With it the array is released and the pointer accounting balances. On an
unmodified build the release still happens via the package temp_data and
the added kfree() sees NULL, with no slab warnings over repeated module
load and unload cycles.
📍 영향받는 시스템
PTS(Package Thermal Support)를 지원하지 않는 CPU를 사용하는 Linux 커널 시스템
⚔️ 공격 벡터
로컬 공격자가 드라이버를 반복적으로 로드/언로드하여 메모리 누수를 유도함으로써 시스템 자원을 고갈시킬 수 있음
🛡️ 대응 방법
해당 패치가 적용된 최신 Linux 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인