linux/mm/damon/tests
SJ Park 488cf81c49 mm/damon/core-kunit: skip wrong region walk in commit_target_regions()
damon_test_commit_target_regions_for() traverses expected values array
after damon_commit_target_regions() call.  It assumes
damon_commit_target_regions() made expected number of regions.  It might
not.  Because the traversal is made based on the region count, it could do
out of bounds access to the expectation value array.

The consequent user impact (out-of-bound access) is quite bad.  The
realistic user impact would be limited, though.  It would affect only test
run setups.

Fix it by testing if the number of regions was also changed as expected
and exit early for the failure.

The issue was discovered [1] by Sashiko.

Link: https://lore.kernel.org/20260718001442.87129-8-sj@kernel.org
Link: https://lore.kernel.org/20260713144757.39740-1-sj@kernel.org [1]
Fixes: 603f67eb91 ("mm/damon/tests/core-kunit: add damon_commit_target_regions() test")
Signed-off-by: SJ Park <sj@kernel.org>
Cc: Brendan Higgins <brendan.higgins@linux.dev>
Cc: <stable@vger.kernel.org> # 6.19.x
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2026-08-06 18:57:17 -07:00
..
.kunitconfig mm/damon/tests/.kunitconifg: enable DAMON_DEBUG_SANITY 2026-04-05 13:53:21 -07:00
core-kunit.h mm/damon/core-kunit: skip wrong region walk in commit_target_regions() 2026-08-06 18:57:17 -07:00
sysfs-kunit.h MAINTAINERS: s/SeongJae/SJ/ 2026-07-09 15:48:53 -07:00
vaddr-kunit.h mm/damon/vaddr-kunit: check region count in three_regions test 2026-08-06 18:57:16 -07:00