aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@samsung.com>2019-03-11 16:58:47 +0300
committerEduardo Habkost <ehabkost@redhat.com>2019-03-11 17:16:56 -0300
commit4a66c7a9996bb1bb1191170b172daa54e226d7ff (patch)
treeffc86e58bff453e6cd3bc64621426c7baf7580a5 /backends
parentf6a0d06ba72a0c493e1e05872caf2f3781af316d (diff)
hostmem-memfd: disable for systems without sealing support
If seals are not supported, memfd_create() will fail. Furthermore, there is no way to disable it in this case because '.seal' property is not registered. This issue leads to vhost-user-test failures on RHEL 7.2: qemu-system-x86_64: -object memory-backend-memfd,id=mem,size=2M,: \ failed to create memfd: Invalid argument and actually breaks the feature on such systems. Let's restrict memfd backend to systems with sealing support. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Message-Id: <20190311135850.6537-2-i.maximets@samsung.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'backends')
-rw-r--r--backends/hostmem-memfd.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c
index 98c9bf3240..46b15b916a 100644
--- a/backends/hostmem-memfd.c
+++ b/backends/hostmem-memfd.c
@@ -154,15 +154,13 @@ memfd_backend_class_init(ObjectClass *oc, void *data)
"Huge pages size (ex: 2M, 1G)",
&error_abort);
}
- if (qemu_memfd_check(MFD_ALLOW_SEALING)) {
- object_class_property_add_bool(oc, "seal",
- memfd_backend_get_seal,
- memfd_backend_set_seal,
- &error_abort);
- object_class_property_set_description(oc, "seal",
- "Seal growing & shrinking",
- &error_abort);
- }
+ object_class_property_add_bool(oc, "seal",
+ memfd_backend_get_seal,
+ memfd_backend_set_seal,
+ &error_abort);
+ object_class_property_set_description(oc, "seal",
+ "Seal growing & shrinking",
+ &error_abort);
}
static const TypeInfo memfd_backend_info = {
@@ -175,7 +173,7 @@ static const TypeInfo memfd_backend_info = {
static void register_types(void)
{
- if (qemu_memfd_check(0)) {
+ if (qemu_memfd_check(MFD_ALLOW_SEALING)) {
type_register_static(&memfd_backend_info);
}
}