onnxruntime
d1135499 - Fix ARM CPUIDInfo bounds handling for unknown CPU vendors (#28344)

Commit
58 days ago
Fix ARM CPUIDInfo bounds handling for unknown CPU vendors (#28344) ### Description ARM Linux CPUIDInfo initialization now validates `cpuinfo` processor Linux CPU IDs before using them to index per-core vectors. - **CPUIDInfo** - Skip processors whose `proc->linux_id` is outside `core_uarchs_` / `is_armv8_narrow_ld_`. - Prevents heap corruption from sparse or unexpected CPU IDs reported by `cpuinfo`. ```cpp auto coreid = proc->linux_id; if (coreid >= core_uarchs_.size()) { continue; } ``` - **Device discovery test** - Allows CPUs with an unknown vendor ID (`0`) as long as the vendor string is populated. - Matches the existing CPUIDInfo fallback behavior of reporting `"unknown"` for unrecognized vendors. ### Motivation and Context On Jetson Orin ARM64 systems, `cpuinfo` can report an unknown CPU vendor and nonstandard CPU topology. `ArmLinuxInit()` sized per-core vectors by core count but indexed them by Linux CPU ID, which could write out of bounds and later surface as `free(): invalid pointer` during `CPUIDInfo` destruction. This change makes ARM CPU feature initialization tolerant of sparse/out-of-range Linux CPU IDs and preserves valid unknown-vendor reporting. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tianleiwu <30328909+tianleiwu@users.noreply.github.com> Co-authored-by: Tianlei Wu <tlwu@microsoft.com>
Author
Parents
Loading