public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] openposix: mmap/21-1: adjust the test to work with MAP_SHARED_VALIDATE
@ 2018-02-08 15:55 Stanislav Kholmanskikh
  2018-02-08 16:34 ` Cyril Hrubis
  0 siblings, 1 reply; 7+ messages in thread
From: Stanislav Kholmanskikh @ 2018-02-08 15:55 UTC (permalink / raw)
  To: ltp

Linux commit 50a8e840d050 ("mm: introduce MAP_SHARED_VALIDATE, a mechanism to safely define new mmap flags")
introduced the MAP_SHARED_VALIDATE flag, which is similar to MAP_SHARED but
provides additional semantics. So on we need to make sure that the invalid
value of 'flags' in the test is generated taking into account this new flag.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
 .../conformance/interfaces/mmap/21-1.c             |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/21-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/21-1.c
index dc0cc13..81114b7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/21-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/21-1.c
@@ -27,6 +27,24 @@
 #include <errno.h>
 #include "posixtest.h"
 
+int is_valid(int flag)
+{
+	if (flag == MAP_SHARED || flag == MAP_PRIVATE || flag == MAP_FIXED)
+		return 1;
+
+#ifdef __linux__
+
+#ifndef MAP_SHARED_VALIDATE
+#define MAP_SHARED_VALIDATE 0x03
+#endif
+
+	if (flag == MAP_SHARED_VALIDATE)
+		return 1;
+#endif
+
+	return 0;
+}
+
 int main(void)
 {
 	char tmpfname[256];
@@ -51,7 +69,7 @@ int main(void)
 	}
 
 	flag = MAP_SHARED;
-	while (flag == MAP_SHARED || flag == MAP_PRIVATE || flag == MAP_FIXED)
+	while (is_valid(flag))
 		flag++;
 
 	pa = mmap(NULL, size, PROT_READ | PROT_WRITE, flag, fd, 0);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-03-01 10:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-08 15:55 [LTP] [PATCH] openposix: mmap/21-1: adjust the test to work with MAP_SHARED_VALIDATE Stanislav Kholmanskikh
2018-02-08 16:34 ` Cyril Hrubis
2018-02-12 12:29   ` Stanislav Kholmanskikh
2018-02-12 15:17     ` Cyril Hrubis
2018-03-01  9:22       ` [LTP] [PATCH] openposix: mmap/21-1: use all bits set as the invalid flag Stanislav Kholmanskikh
2018-03-01  9:50         ` Cyril Hrubis
2018-03-01 10:59           ` Stanislav Kholmanskikh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox