selftests/damon: test removed scheme sysfs dir access bug
authorSeongJae Park <sj@kernel.org>
Thu, 1 Dec 2022 17:08:34 +0000 (17:08 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 Dec 2022 02:12:15 +0000 (18:12 -0800)
commit0b7623bdf89b9f6d320784e929acb78291aaf5f6
treeb791de38cd0c561b25515e27ef614017d9ed877c
parentc8c7016f50c85688d71feea2dba1bd955d5f5358
selftests/damon: test removed scheme sysfs dir access bug

A DAMON sysfs user could start DAMON with a scheme, remove the sysfs
directory for the scheme, and then ask stats or schemes tried regions
update.  The related logic were not aware of the already removed directory
situation, so it was able to results in invalid memory accesses.  The fix
has made with commit 8468b486612c ("mm/damon/sysfs-schemes: skip stats
update if the scheme directory is removed"), though.  Add a selftest to
prevent such kinds of bugs from being introduced again.

Link: https://lkml.kernel.org/r/20221201170834.62823-1-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/damon/Makefile
tools/testing/selftests/damon/sysfs_update_removed_scheme_dir.sh [new file with mode: 0644]