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