v1
2026-11-05
修复 page_owner_sort 重叠拷贝 · v1
remove_pattern() 对同一缓冲区内的重叠区间使用 memcpy() 属未定义行为,改为 memmove(),修复 page_owner_sort 的重叠拷贝告警。
原始补丁链接
子 Patch(3)
1/3
tools/mm: use memmove() to drop the timestamp from a record
page_owner_sort 的 remove_pattern() 在删除时间戳时源/目标缓冲区重叠,memcpy() 属未定义行为并触发 ASan;改用 memmove() 处理重叠范围。
2/3
tools/mm: terminate the record buffer before matching the timestamp
add_list() 复制记录后未先写终止符就让 regexec() 匹配时间戳,导致堆越界;改为 memcpy 后立即置 NUL,删除模式后仍保留终止符。
3/3
tools/mm: keep the allocator scan inside the record
get_allocator() 向前找 __vmalloc_node_range 上一帧时可能越过记录/缓冲区起点;改为记录行首并在到达 buffer 起始处停止扫描,修复左侧越界读。