selftests-mm-add-mseal-test-for-no-discard-madvise.patch removed from -mm tree
The quilt patch titled
Subject: selftests/mm: add mseal test for no-discard madvise
has been removed from the -mm tree. Its filename was
selftests-mm-add-mseal-test-for-no-discard-madvise.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Pedro Falcato <[email protected]>
Subject: selftests/mm: add mseal test for no-discard madvise
Date: Wed, 7 Aug 2024 18:33:36 +0100
Add an mseal test for madvise() operations that aren't considered "discard" (e.g purely advisory ops such as MADV_RANDOM).
---
tools/testing/selftests/mm/mseal_test.c | 36 +++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-)
tools/testing/selftests/mm/mseal_test.c renamed from tools/testing/selftests/mm/mseal_test.c~selftests-mm-add-mseal-test-for-no-discard-madvise +35 -1
@@ -1731,6 +1731,38 @@ static void test_seal_discard_ro_anon(boREPORT_TEST_PASS (); } +static void test_seal_madvise_nodiscard (bool seal) +{ +void *ptr; +unsigned long page_size =getpagesize (); +unsigned long size =4 * page_size; +int ret; + +setup_single_address (size, &ptr); +FAIL_TEST_IF_FALSE (ptr != (void *)-1 ); + +if (seal) { + ret =seal_single_address (ptr, size); +FAIL_TEST_IF_FALSE (!ret); + } + +/* +* Test a random madvise flag like MADV_RANDOM that does not touch page +* contents (and thus should work for msealed VMAs). RANDOM also happens to +* share bits with other discard-ish flags like REMOVE. +*/ + ret =sys_madvise (ptr, size,MADV_RANDOM ); +FAIL_TEST_IF_FALSE (!ret); + + ret =sys_munmap (ptr, size); +if (seal) +FAIL_TEST_IF_FALSE (ret <0 ); +else +FAIL_TEST_IF_FALSE (!ret); + +REPORT_TEST_PASS (); +} +int main (int argc,char **argv) {bool test_seal =seal_support ();
@@ -1743,7 +1775,7 @@ int main(int argc, char **argv)if (!pkey_supported ())ksft_print_msg ("PKEY not supported\n" ); -ksft_set_plan (80 ); +ksft_set_plan (82 );test_seal_addseal ();test_seal_unmapped_start ();
@@ -1822,6 +1854,8 @@ int main(int argc, char **argv)test_seal_mremap_move_fixed_zero (true);test_seal_mremap_move_dontunmap_anyaddr (false);test_seal_mremap_move_dontunmap_anyaddr (true); +test_seal_madvise_nodiscard (false); +test_seal_madvise_nodiscard (true);test_seal_discard_ro_anon (false);test_seal_discard_ro_anon (true);test_seal_discard_ro_anon_on_rw (false);
_
Patches currently in -mm which might be from [email protected] are
mm-move-can_modify_vma-to-mm-vmah.patch mm-munmap-replace-can_modify_mm-with-can_modify_vma.patch mm-mprotect-replace-can_modify_mm-with-can_modify_vma.patch mm-mremap-replace-can_modify_mm-with-can_modify_vma.patch mseal-replace-can_modify_mm_madv-with-a-vma-variant.patch mm-remove-can_modify_mm.patch selftests-mm-add-more-mseal-traversal-tests.patch selftests-mm-add-more-mseal-traversal-tests-fix-2.patch