🔍 CVE-2025-38170

5.5
CVSS Score
MEDIUM
2025-07-03
2026-11-05 21:18
✅ 완료

🇰🇷 한글 설명

Linux 커널 arm64 아키텍처에서 SME(Scalable Matrix Extension) 트랩 처리 중 선점(preemption)과 CPU 마이그레이션이 겹치면 오래된(stale) CPU 상태가 재사용될 수 있는 경쟁 조건이 존재합니다. 이로 인해 do_sme_acc()에서 경고가 발생하고 사용자 공간 복귀 시 레지스터 상태 복원이 생략될 수 있습니다. 해당 문제는 fpsimd_flush_task_state() 호출로 저장된 CPU 상태와의 연결을 끊어 수정되었습니다.

💡 쉬운 설명

프로세서의 행렬 연산 기능을 처리하는 과정에서 작업이 다른 CPU로 옮겨질 때 이전 데이터가 잘못 재사용될 수 있는 결함입니다. 이 패치는 잘못된 이전 상태를 버리고 올바른 상태를 다시 불러오도록 수정합니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: arm64/fpsimd: Discard stale CPU state when handling SME traps The logic for handling SME traps manipulates saved FPSIMD/SVE/SME state incorrectly, and a race with preemption can result in a task having TIF_SME set and TIF_FOREIGN_FPSTATE clear even though the live CPU state is stale (e.g. with SME traps enabled). This can result in warnings from do_sme_acc() where SME traps are not expected while TIF_SME is set: | /* With TIF_SME userspace shouldn't generate any traps */ | if (test_and_set_thread_flag(TIF_SME)) | WARN_ON(1); This is very similar to the SVE issue we fixed in commit: 751ecf6afd6568ad ("arm64/sve: Discard stale CPU state when handling SVE traps") The race can occur when the SME trap handler is preempted before and after manipulating the saved FPSIMD/SVE/SME state, starting and ending on the same CPU, e.g. | void do_sme_acc(unsigned long esr, struct pt_regs *regs) | { | // Trap on CPU 0 with TIF_SME clear, SME traps enabled | // task->fpsimd_cpu is 0. | // per_cpu_ptr(&fpsimd_last_state, 0) is task. | | ... | | // Preempted; migrated from CPU 0 to CPU 1. | // TIF_FOREIGN_FPSTATE is set. | | get_cpu_fpsimd_context(); | | /* With TIF_SME userspace shouldn't generate any traps */ | if (test_and_set_thread_flag(TIF_SME)) | WARN_ON(1); | | if (!test_thread_flag(TIF_FOREIGN_FPSTATE)) { | unsigned long vq_minus_one = | sve_vq_from_vl(task_get_sme_vl(current)) - 1; | sme_set_vq(vq_minus_one); | | fpsimd_bind_task_to_cpu(); | } | | put_cpu_fpsimd_context(); | | // Preempted; migrated from CPU 1 to CPU 0. | // task->fpsimd_cpu is still 0 | // If per_cpu_ptr(&fpsimd_last_state, 0) is still task then: | // - Stale HW state is reused (with SME traps enabled) | // - TIF_FOREIGN_FPSTATE is cleared | // - A return to userspace skips HW state restore | } Fix the case where the state is not live and TIF_FOREIGN_FPSTATE is set by calling fpsimd_flush_task_state() to detach from the saved CPU state. This ensures that a subsequent context switch will not reuse the stale CPU state, and will instead set TIF_FOREIGN_FPSTATE, forcing the new state to be reloaded from memory prior to a return to userspace. Note: this was originallly posted as [1]. [ Rutland: rewrite commit message ]

📍 영향받는 시스템

SME를 지원하는 arm64 아키텍처 기반 Linux 커널(수정 이전 버전)

⚔️ 공격 벡터

로컬 사용자 권한의 프로세스가 SME 명령을 사용하는 과정에서 선점 타이밍에 따라 커널 경고 및 레지스터 상태 불일치를 유발할 수 있음 (주로 안정성 및 정보 무결성 문제)

🛡️ 대응 방법

배포판 제공 최신 커널로 업데이트하여 해당 upstream 패치가 포함된 버전을 설치

🔧 검증 코드

출력된 커널 버전을 배포판 보안 공지에서 확인하여 CVE-2025-38170 패치가 포함된 버전인지 대조하고, 시스템이 arm64인지는 uname -m 결과가 aarch64인지로 확인합니다.

Shell / Script
uname -r

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

💻 영향받는 소프트웨어

Linux Kernel