summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Rapoport <rppt@linux.ibm.com>2020-05-25 22:00:53 +0300
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2020-05-27 07:06:38 -0700
commite664743c81fd5ba89b9294b9d4ec665248228581 (patch)
tree28c41c8790b982add78bae3a1743498061048b47
parent5237f266dcff55147779ba4be903fcca07c598d0 (diff)
downloadsecret-memory-preloader-e664743c81fd5ba89b9294b9d4ec665248228581.tar.gz
Add environment variable to select secret memory typeHEADmaster
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
-rw-r--r--preload.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/preload.c b/preload.c
index f5445ed..67fc793 100644
--- a/preload.c
+++ b/preload.c
@@ -181,6 +181,7 @@ static void show_segment(void)
}
static int use_secret = 1;
+static int secret_option = MFD_SECRET_EXCLUSIVE;
static void alloc_segment(void)
{
@@ -198,7 +199,7 @@ static void alloc_segment(void)
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 @@ void __attribute__ ((constructor)) preload_setup(void)
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;