lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230524093836.21038-1-xu.xin16@zte.com.cn>
Date:   Wed, 24 May 2023 17:38:36 +0800
From:   xu xin <xu.xin.sc@...il.com>
To:     david@...hat.com
Cc:     akpm@...ux-foundation.org, imbrenda@...ux.ibm.com,
        jiang.xuexin@....com.cn, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, ran.xiaokai@....com.cn, xu.xin.sc@...il.com,
        xu.xin16@....com.cn, yang.yang29@....com.cn
Subject: Re: [PATCH v9 5/5] selftest: add a testcase of ksm zero pages

>> +	if (write(ksm_use_zero_pages_fd, "1", 1) != 1) {
>> +		ksft_test_result_skip("write \"/sys/kernel/mm/ksm/use_zero_pages\" failed\n");
>> +		return;
>> +	}
>
>I realize that this test will fail if there is any other process in the system that has KSM
>Enabled with a suitable page filled with zeroes ... maybe instead of checking the global
>KSM zeropages, check the per-mm ones instead? That should be better

Emmm, yes. It makes sense. I'll do it per-mm in next-version.

>You could do something like the following on top (I recall you had some kind of COW
>tests previously, this should be a simplified version of it):
>

Ok. Thank you.

>diff --git a/tools/testing/selftests/mm/ksm_functional_tests.c b/tools/testing/selftests/mm/ksm_functional_tests.c
>index ea060c683c80..160675a4e3d2 100644
>--- a/tools/testing/selftests/mm/ksm_functional_tests.c
>+++ b/tools/testing/selftests/mm/ksm_functional_tests.c
>@@ -182,6 +182,7 @@ static void test_unmerge(void)
>  static void test_unmerge_zero_pages(void)
>  {
>  	const unsigned int size = 2 * MiB;
>+	unsigned int offs;
>  	char *map;
>  	unsigned long pages_expected;
>  
>@@ -225,8 +226,18 @@ static void test_unmerge_zero_pages(void)
>  		goto unmap;
>  	}
>  
>+	/* Trigger unmerging of the other half by writing to the pages. */
>+	for (offs = size / 2; offs < size; offs += pagesize)
>+		*((unsigned int *)&map[offs]) = offs;
>+
>+	/* We should have no zeropages remaining. */
>+	if (get_ksm_zero_pages()) {
>+		ksft_test_result_fail("'ksm_zero_pages' updated after write fault\n");
>+		goto unmap;
>+	}
>+
>  	/* Check if ksm zero pages are really unmerged */
>-	ksft_test_result(!range_maps_duplicates(map, size / 2),
>+	ksft_test_result(!range_maps_duplicates(map, size),
>  				"KSM zero pages were unmerged\n");
>  unmap:
>  	munmap(map, size);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ