From 559d5899473dea180ced39a32bfbfbf2310c6e04 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Mon, 25 May 2020 15:33:06 +0100
Subject: [PATCH 4/7] Revert "RHEL: disable hostmem-memfd"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: <20200525153306.15373-1-marcandre.lureau@redhat.com>
Patchwork-id: 96747
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH] Revert "RHEL: disable hostmem-memfd"
Bugzilla: 1839030
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1839030
BRANCH: rhel-av-8.2.1
UPSTREAM: RHEL-only
BREW: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=28817132

This reverts commit f7587ddb9a2731bf678a24156b6285dda79a4b2b.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
 backends/Makefile.objs | 3 +--
 util/memfd.c           | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/backends/Makefile.objs b/backends/Makefile.objs
index f328d40..f069111 100644
--- a/backends/Makefile.objs
+++ b/backends/Makefile.objs
@@ -16,5 +16,4 @@ endif
 
 common-obj-$(call land,$(CONFIG_VHOST_USER),$(CONFIG_VIRTIO)) += vhost-user.o
 
-# RHEL: disable memfd
-# common-obj-$(CONFIG_LINUX) += hostmem-memfd.o
+common-obj-$(CONFIG_LINUX) += hostmem-memfd.o
diff --git a/util/memfd.c b/util/memfd.c
index 3303ec9..4a3c07e 100644
--- a/util/memfd.c
+++ b/util/memfd.c
@@ -193,7 +193,7 @@ bool qemu_memfd_alloc_check(void)
  */
 bool qemu_memfd_check(unsigned int flags)
 {
-#if 0 /* RHEL: memfd support disabled */
+#ifdef CONFIG_LINUX
     int mfd = memfd_create("test", flags | MFD_CLOEXEC);
 
     if (mfd >= 0) {
-- 
1.8.3.1

