[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 4/7] hostmem-memfd: disable for systems without seali
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 4/7] hostmem-memfd: disable for systems without sealing support |
Date: |
Mon, 11 Mar 2019 21:59:27 -0300 |
From: Ilya Maximets <address@hidden>
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 <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
backends/hostmem-memfd.c | 18 ++++++++----------
tests/vhost-user-test.c | 5 +++--
2 files changed, 11 insertions(+), 12 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);
}
}
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 0c965b3b1e..3817966010 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -178,7 +178,8 @@ static void append_mem_opts(TestServer *server, GString
*cmd_line,
int size, enum test_memfd memfd)
{
if (memfd == TEST_MEMFD_AUTO) {
- memfd = qemu_memfd_check(0) ? TEST_MEMFD_YES : TEST_MEMFD_NO;
+ memfd = qemu_memfd_check(MFD_ALLOW_SEALING) ? TEST_MEMFD_YES
+ : TEST_MEMFD_NO;
}
if (memfd == TEST_MEMFD_YES) {
@@ -930,7 +931,7 @@ static void register_vhost_user_test(void)
"virtio-net",
test_read_guest_mem, &opts);
- if (qemu_memfd_check(0)) {
+ if (qemu_memfd_check(MFD_ALLOW_SEALING)) {
opts.before = vhost_user_test_setup_memfd;
qos_add_test("vhost-user/read-guest-mem/memfd",
"virtio-net",
--
2.18.0.rc1.1.g3f1ff2140
- [Qemu-devel] [PULL 0/7] Machine queue, 2019-03-11, Eduardo Habkost, 2019/03/11
- [Qemu-devel] [PULL 7/7] memfd: improve error messages, Eduardo Habkost, 2019/03/11
- [Qemu-devel] [PULL 5/7] memfd: always check for MFD_CLOEXEC, Eduardo Habkost, 2019/03/11
- [Qemu-devel] [PULL 6/7] memfd: set up correct errno if not supported, Eduardo Habkost, 2019/03/11
- [Qemu-devel] [PULL 4/7] hostmem-memfd: disable for systems without sealing support,
Eduardo Habkost <=
- [Qemu-devel] [PULL 1/7] hostmem-file: reject invalid pmem file sizes, Eduardo Habkost, 2019/03/11
- [Qemu-devel] [PULL 3/7] machine: Move nvdimms state into struct MachineState, Eduardo Habkost, 2019/03/11
- [Qemu-devel] [PULL 2/7] nvdimm: Rename AcpiNVDIMMState into NVDIMMState, Eduardo Habkost, 2019/03/11
- Re: [Qemu-devel] [PULL 0/7] Machine queue, 2019-03-11, Peter Maydell, 2019/03/12