diff mbox

[ndctl] test, device-dax: validate MAP_PRIVATE attempts fail

Message ID 147206761508.20661.1862644673812635246.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Williams Aug. 24, 2016, 7:40 p.m. UTC
Device-DAX explicitly disallows MAP_PRIVATE mappings.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/device-dax.c |    6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

diff --git a/test/device-dax.c b/test/device-dax.c
index 34ca284f2ef5..a14e2a95db7e 100644
--- a/test/device-dax.c
+++ b/test/device-dax.c
@@ -113,6 +113,12 @@  static int test_device_dax(int loglevel, struct ndctl_test *test,
 		return -ENXIO;
 	}
 
+	buf = mmap(NULL, 2UL << 20, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
+	if (buf != MAP_FAILED) {
+		fprintf(stderr, "%s: expected MAP_PRIVATE failure\n", path);
+		return -ENXIO;
+	}
+
 	buf = mmap(NULL, 2UL << 20, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
 	p = (int *) (buf + (1UL << 20));
 	*p = 0;