Add environment variable to select secret memory type

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
diff --git a/preload.c b/preload.c
index f5445ed..67fc793 100644
--- a/preload.c
+++ b/preload.c
@@ -181,6 +181,7 @@
 }
 
 static int use_secret = 1;
+static int secret_option = MFD_SECRET_EXCLUSIVE;
 
 static void alloc_segment(void)
 {
@@ -198,7 +199,7 @@
 	check(fd < 0, "memfd_create");
 
 	if (use_secret) {
-		ret = ioctl(fd, MFD_SECRET_EXCLUSIVE);
+		ret = ioctl(fd, secret_option);
 		check(ret < 0, "ioctl");
 	}
 
@@ -245,6 +246,8 @@
 		debug = atoi(getenv("MALLOC_DEBUG"));
 	if (getenv("NO_SECRET_MEM") != NULL)
 		use_secret = 0;
+	if (getenv("SECRET_UNCACHED") != NULL)
+		secret_option = MFD_SECRET_UNCACHED;
 
 	m.free.fd = &m.free;
 	m.free.bk = &m.free;