All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Added error message for qemu-user fake_open which clears up misleading open() errors which are caused by QEMU interception of open() rather than the linux-user's open()
@ 2022-06-22  2:43 Brandon Falk
  0 siblings, 0 replies; only message in thread
From: Brandon Falk @ 2022-06-22  2:43 UTC (permalink / raw)
  To: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 403 bytes --]

Add error message for fake open calls when failing to create a temporary
file. I spent some time debugging an issue where for some reason I thought
/proc was misbehaving in the linux-user chroot environment, but it was
rather QEMU silently failing (and passing through an error) to the guest
application, even though it was a QEMU issue related to creating a
temporary file in the chrooted environment.

[-- Attachment #1.2: Type: text/html, Size: 429 bytes --]

[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 1168 bytes --]

From 8f35a893176b61cd9de82bf80c60049c05597e7a Mon Sep 17 00:00:00 2001
From: Brandon Falk <bfalk@gamozolabs.com>
Date: Tue, 21 Jun 2022 18:47:24 -0700
Subject: [PATCH] Added error message for qemu-user fake_open which clears up
 misleading open() errors which are caused by QEMU interception of open()
 rather than the linux-user's open()

Signed-off-by: Brandon Falk <bfalk@gamozolabs.com>
---
 linux-user/syscall.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f55cdebee5..acd7b2063e 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8263,6 +8263,10 @@ static int do_openat(CPUArchState *cpu_env, int dirfd, const char *pathname, int
         snprintf(filename, sizeof(filename), "%s/qemu-open.XXXXXX", tmpdir);
         fd = mkstemp(filename);
         if (fd < 0) {
+            fprintf(stderr,
+                    "qemu-user: Could not create temporary file for "
+                    "fake_open, set $TMPDIR to a valid path or create /tmp. "
+                    "Returning error for open() of %s\n", pathname);
             return fd;
         }
         unlink(filename);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-22 13:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22  2:43 [PATCH] Added error message for qemu-user fake_open which clears up misleading open() errors which are caused by QEMU interception of open() rather than the linux-user's open() Brandon Falk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.