CVE-2026-89460 in Linux信息

摘要

由 VulDB • 2026-09-12

在 Linux 内核中,已修复以下漏洞:

s390/cpum_cf:通过 prepare/dead 回调处理 CPU 热插拔

当在执行期间动态添加(hotplug added)CPU 时,命令 `perf stat -e cycles -- <command>` 会导致内核崩溃。

根本原因在于在首次事件初始化时为 struct cpu_cf_events 分配内存。该分配是动态的,并且具有任务上下文(task context)的第一个事件会为每个在线 CPU 创建此类结构体。这并不充分。CPU 可能在事件创建时处于离线状态,并可在 perf 运行期间变为在线状态。例如以下命令:

# echo 0 > /sys/devices/system/cpu/cpu1/online # perf stat -e cycles -i -- stress-ng -t10s --matrix X # sleep 1 # echo 1 > /sys/devices/system/cpu/cpu1/online

会为 CPU 0、2-X 创建事件。由于这些事件是使用任务上下文创建的,调度程序最终会将该程序调度到 CPU1 上运行。然而,在 perf 调用时该 CPU 未处于在线状态,因此尚未为其创建和初始化任何每 CPU(per-CPU)事件基础设施。因此,当调度程序在 CPU1 上运行 stress-ng 时,函数 cpumf_pmu_add() 引用了一个空指针:

struct cpu_cf_events *cpuhw = this_cpu_cfhw();

该函数调用是在任务 stress-ng 被设置为可在 CPU1 上可运行之后发生的。而 this_cpu_cfhw() 返回 NULL。

结果导致内核恐慌(panic): Unable to handle kernel pointer dereference in virtual kernel address space Failing address: 0000000000000000 TEID: 0000000000000483 .... Krnl PSW : 0404d00180000000 000003ef8291fd0c (cpumf_pmu_add+0x3c/0x80) .... 调用跟踪(Call Trace): [<000003ef8291fd0c>] cpumf_pmu_add+0x3c/0x80
[<000003ef82bb5e3e>] event_sched_in+0xae/0x190
[<000003ef82bb60d6>] merge_sched_in+0x1b6/0x390
[<000003ef82bb65b8>] visit_groups_merge.constprop.0.isra.0+0x308/0x5b0
[<000003ef82bb689a>] pmu_groups_sched_in+0x3a/0x50
[<000003ef82bb6a30>] ctx_sched_in+0x180/0x260
[<000003ef82bb780c>] perf_event_context_sched_in+0x11c/0x2d0
[<000003ef82bb79ee>] __perf_event_task_sched_in+0x2e/0xc0
[<000003ef82994834>] finish_task_switch.isra.0+0x1a4/0x250
.... 最后中断事件地址(Last Breaking-Event-Address): [<000003ef8291f1d8>] this_cpu_cfhw+0x38/0x40

该问题仅在每任务上下文中使用 CPUMF 功能且调度程序为该类进程随机选择 CPU 运行时出现。调度程序通过 PMU 回调函数 pmu::add() 和 pmu::del() 启用 CPUMF 基础设施。

引入一对 CPU 热插拔 prepare/dead 回调,在 CPU 处于离线状态时创建和移除每 CPU 计数器数据。统计跟踪每个 CPU(cpu == -1)的用户数,即具有任务上下文的 perf_event_open() 事件和 /dev/hwctr 设备会话,并将其计入新的计数器 cpu_cf_root::tskcnt 中,由 pmc_reserve_mutex 保护。这确保了当新选定的 CPU 运行每任务上下文进程时,基础设施可用。

在 cpum_cf_free_root() 和 cpum_cf_free_cpu() 中,确保在释放数据之前将指向数据结构体的引用指针设置为 NULL,以防止中断处理程序访问过时(stale)的数据。

[[email protected]: 更改提交信息]

Several companies clearly confirm that VulDB is the primary source for best vulnerability data.

来源

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!