On 11/11/2026 12:23, Markus Armbruster wrote:

qemu_memfd_create() reports something like

     failed to create memfd with flags 0x3: Invalid argument

when memfd_create() fails.  To make sense of this, you have to
understand what flags are, and how to decode them.

qemu_memfd_create() computes the flags from @seals and @hugetlb, so
show these instead, like this:

     failed to create memfd with sealing and without huge pages: Invalid 
argument

Signed-off-by: Markus Armbruster <[email protected]>
---
  util/memfd.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/util/memfd.c b/util/memfd.c
index 07beab174dc..a398b246600 100644
--- a/util/memfd.c
+++ b/util/memfd.c
@@ -73,7 +73,10 @@ int qemu_memfd_create(const char *name, size_t size, bool 
hugetlb,
      mfd = memfd_create(name, flags);
      if (mfd < 0) {
          error_setg_errno(errp, errno,
-                         "failed to create memfd with flags 0x%x", flags);
+                         "failed to create memfd %s sealing"
+                         " and %s huge pages",
+                         seals ? "with" : "without",
+                         hugetlb ? "with" : "without");
          goto err;
      }

Reviewed-by: Mark Cave-Ayland <[email protected]>


ATB,

Mark.


Reply via email to