Blame SOURCES/0005-ndctl-test-Fix-device-dax-mremap-test.patch

e0018b
From 6694afe31dd67d186199a58d2252be5ea3472692 Mon Sep 17 00:00:00 2001
e0018b
From: Dan Williams <dan.j.williams@intel.com>
e0018b
Date: Tue, 12 Jan 2021 23:15:09 -0800
e0018b
Subject: [PATCH 005/217] ndctl/test: Fix device-dax mremap() test
e0018b
e0018b
The test_dax_remap() test is a regression check for mishandling of mremap()
e0018b
in the presence of pmd_devmap(). My understanding is that it was a fuzzing
e0018b
condition not something an application would want to do in practice.
e0018b
e0018b
On recent kernels with commit 73d5e0629919 ("mremap: check if it's possible
e0018b
to split original vma"), the test fails for device-dax. That seems an
e0018b
equally acceptable result of attempting this remap, so update the test
e0018b
rather than ask the kernel to preserve the old behaviour.
e0018b
e0018b
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
e0018b
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
e0018b
Link: https://lore.kernel.org/r/161052210936.1804207.17896246772670985157.stgit@dwillia2-desk3.amr.corp.intel.com
e0018b
---
e0018b
 test/dax-pmd.c | 5 +++++
e0018b
 1 file changed, 5 insertions(+)
e0018b
e0018b
diff --git a/test/dax-pmd.c b/test/dax-pmd.c
e0018b
index b1251db..7648e34 100644
e0018b
--- a/test/dax-pmd.c
e0018b
+++ b/test/dax-pmd.c
e0018b
@@ -69,6 +69,11 @@ int test_dax_remap(struct ndctl_test *test, int dax_fd, unsigned long align, voi
e0018b
 
e0018b
 	remap = mremap(addr, REMAP_SIZE, REMAP_SIZE, MREMAP_MAYMOVE|MREMAP_FIXED, anon);
e0018b
 
e0018b
+	if (remap == MAP_FAILED) {
e0018b
+		fprintf(stderr, "%s: mremap failed, that's ok too\n", __func__);
e0018b
+		return 0;
e0018b
+	}
e0018b
+
e0018b
 	if (remap != anon) {
e0018b
 		rc = -ENXIO;
e0018b
 		perror("mremap");
e0018b
-- 
e0018b
2.27.0
e0018b