]> git.proxmox.com Git - mirror_qemu.git/commitdiff
memfd: always check for MFD_CLOEXEC
authorIlya Maximets <i.maximets@samsung.com>
Mon, 11 Mar 2019 13:58:48 +0000 (16:58 +0300)
committerEduardo Habkost <ehabkost@redhat.com>
Mon, 11 Mar 2019 20:17:00 +0000 (17:17 -0300)
QEMU always sets this flag unconditionally. We need to
check if it's supported.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190311135850.6537-3-i.maximets@samsung.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
util/memfd.c

index 8debd0d037e09fca704973bc4ea238137ec9a774..d74ce4d793d019d5b8a335a9f535b085114c4171 100644 (file)
@@ -188,7 +188,7 @@ bool qemu_memfd_alloc_check(void)
 bool qemu_memfd_check(unsigned int flags)
 {
 #ifdef CONFIG_LINUX
-    int mfd = memfd_create("test", flags);
+    int mfd = memfd_create("test", flags | MFD_CLOEXEC);
 
     if (mfd >= 0) {
         close(mfd);