diff options
| author | Ali Ahmet Memis <ali@iusegentoo.com> | 2026-07-30 06:00:31 +0300 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2026-10-01 10:26:33 -0400 |
| commit | c24362650f7a8573dc9a9991a034b8500af8eb19 (patch) | |
| tree | 1dbc906a3fa50c337eae693cb376c852875b5fac /tools/perf/scripts/python/stackcollapse.py | |
| parent | 72d3fcf802c45d00b300f25b848a93c3a2bd7c7e (diff) | |
| download | linux-next-c24362650f7a8573dc9a9991a034b8500af8eb19.tar.gz linux-next-c24362650f7a8573dc9a9991a034b8500af8eb19.zip | |
tools/power turbostat: Read complete CPU lists
CPU_SUBSET_MAXCPUS accepts CPU IDs through 8191, but the sysfs and
cgroup CPU-list readers stop at 1024 bytes. A fragmented cpuset or
hybrid PMU CPU list can exceed that size and be truncated.
initialize_cpu_set_from_sysfs() can also pass a full, non-NUL-terminated
buffer to parse_cpu_str(), causing an out-of-bounds read.
Additionally, initialize_cpu_set_from_sysfs() returns with the file
still open on success. It is now called once per CPU for
thread_siblings_list, so large systems can leak thousands of descriptors
during topology discovery.
Use getline() so both readers receive a complete, NUL-terminated line.
Close and free the sysfs CPU-list resources on every path, and report
malformed input from the correct buffer.
Fixes: eb187540d13a ("tools/power turbostat: Increase CPU_SUBSET_MAXCPUS to 8192")
Fixes: 58839fdbd441 ("tools/power turbostat: Process HT siblings in CPU order")
Cc: stable@vger.kernel.org
Signed-off-by: Ali Ahmet Memis <ali@iusegentoo.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
