summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/exported-sql-viewer.py
diff options
context:
space:
mode:
authorReinette Chatre <reinette.chatre@intel.com>2024-10-25 00:18:40 +0300
committerShuah Khan <skhan@linuxfoundation.org>2024-11-05 03:02:02 +0300
commitcaf02626b2bf164a02c808240f19dbf97aced664 (patch)
tree879aea10afe664c2cc923947dfdc6b03597d3099 /tools/perf/scripts/python/exported-sql-viewer.py
parent1b4840395f08e9723a15fea42c2d31090e8375f3 (diff)
downloadlinux-caf02626b2bf164a02c808240f19dbf97aced664.tar.xz
selftests/resctrl: Fix memory overflow due to unhandled wraparound
alloc_buffer() allocates and initializes (with random data) a buffer of requested size. The initialization starts from the beginning of the allocated buffer and incrementally assigns sizeof(uint64_t) random data to each cache line. The initialization uses the size of the buffer to control the initialization flow, decrementing the amount of buffer needing to be initialized after each iteration. The size of the buffer is stored in an unsigned (size_t) variable s64 and the test "s64 > 0" is used to decide if initialization is complete. The problem is that decrementing the buffer size may wrap around if the buffer size is not divisible by "CL_SIZE / sizeof(uint64_t)" resulting in the "s64 > 0" test being true and memory beyond the buffer "initialized". Use a signed value for the buffer size to support all buffer sizes. Fixes: a2561b12fe39 ("selftests/resctrl: Add built in benchmark") Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions