Skip to contentSkip to conversation

selftests/damon: test removed scheme sysfs dir access bug

PATCH Applied SeongJae Park 1 participant 1 message Dec 1, 2022

Subsystems (3)
lore
Share & tools
lore

SeongJae Park

author maintainer
#0 lore raw

PATCH 1/1 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 avoid such kind of bugs be introduced again.

---
 tools/testing/selftests/damon/Makefile        |  2 +-
 .../damon/sysfs_update_removed_scheme_dir.sh  | 58 +++++++++++++++++++
 2 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/damon/sysfs_update_removed_scheme_dir.sh
tools/testing/selftests/damon/Makefile +1 -1
index 838a8e49f77b..b71247ba7196 100644
@@ -8,7 +8,7 @@ TEST_PROGS = debugfs_attrs.sh debugfs_schemes.sh debugfs_target_ids.sh
 TEST_PROGS += debugfs_empty_targets.sh debugfs_huge_count_read_write.sh
 TEST_PROGS += debugfs_duplicate_context_creation.sh
 TEST_PROGS += debugfs_rm_non_contexts.sh
-TEST_PROGS += sysfs.sh
+TEST_PROGS += sysfs.sh sysfs_update_removed_scheme_dir.sh
 TEST_PROGS += reclaim.sh lru_sort.sh
 
 include ../lib.mk
tools/testing/selftests/damon/sysfs_update_removed_scheme_dir.sh new file +58 -0

58 lines not on this page · raw message

Signature · 1 line
2.25.1