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