qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1709170] [NEW] QEMU fails to honor O_TMPFILE
@ 2017-08-07 20:18 Thiago Macieira
  2017-08-08  6:47 ` [Qemu-devel] [Bug 1709170] " Riku Voipio
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Thiago Macieira @ 2017-08-07 20:18 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

When making a call like

  open("/tmp", O_TMPFILE | O_RDWR);

under QEMU, we ged -EISDIR.

Under any kernel 3.11 or later, we are supposed to get an unnamed file
in /tmp. In case the filesystem for /tmp does not support unnamed files,
we are supposed to get EOPNOTSUPP.

[I don't know the QEMU version, since this happened in a system I don't
have access to]

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1709170

Title:
  QEMU fails to honor O_TMPFILE

Status in QEMU:
  New

Bug description:
  When making a call like

    open("/tmp", O_TMPFILE | O_RDWR);

  under QEMU, we ged -EISDIR.

  Under any kernel 3.11 or later, we are supposed to get an unnamed file
  in /tmp. In case the filesystem for /tmp does not support unnamed
  files, we are supposed to get EOPNOTSUPP.

  [I don't know the QEMU version, since this happened in a system I
  don't have access to]

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1709170/+subscriptions

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [Bug 1709170] Re: QEMU fails to honor O_TMPFILE
  2017-08-07 20:18 [Qemu-devel] [Bug 1709170] [NEW] QEMU fails to honor O_TMPFILE Thiago Macieira
@ 2017-08-08  6:47 ` Riku Voipio
  2017-08-08 13:19 ` [Qemu-devel] [Bug 1709170] [NEW] " Riku Voipio
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Riku Voipio @ 2017-08-08  6:47 UTC (permalink / raw)
  To: qemu-devel

Hi Thiago,

What is the version of glibc on the targets you are building to? There
was an O_TMPFILE bug in older glibc's:

https://sourceware.org/bugzilla/show_bug.cgi?id=17912

** Bug watch added: Sourceware.org Bugzilla #17912
   https://sourceware.org/bugzilla/show_bug.cgi?id=17912

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1709170

Title:
  QEMU fails to honor O_TMPFILE

Status in QEMU:
  New

Bug description:
  When making a call like

    open("/tmp", O_TMPFILE | O_RDWR);

  under QEMU, we ged -EISDIR.

  Under any kernel 3.11 or later, we are supposed to get an unnamed file
  in /tmp. In case the filesystem for /tmp does not support unnamed
  files, we are supposed to get EOPNOTSUPP.

  [I don't know the QEMU version, since this happened in a system I
  don't have access to]

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1709170/+subscriptions

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [Bug 1709170] [NEW] QEMU fails to honor O_TMPFILE
  2017-08-07 20:18 [Qemu-devel] [Bug 1709170] [NEW] QEMU fails to honor O_TMPFILE Thiago Macieira
  2017-08-08  6:47 ` [Qemu-devel] [Bug 1709170] " Riku Voipio
@ 2017-08-08 13:19 ` Riku Voipio
  2017-08-08 13:21 ` [Qemu-devel] [Bug 1709170] [PATCH] linux-user: fix O_TMPFILE handling Riku Voipio
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Riku Voipio @ 2017-08-08 13:19 UTC (permalink / raw)
  To: Bug 1709170; +Cc: qemu-devel, thiago

On Mon, Aug 07, 2017 at 08:18:04PM -0000, Thiago Macieira wrote:
> Public bug reported:
> 
> When making a call like
> 
>   open("/tmp", O_TMPFILE | O_RDWR);
> 
> under QEMU, we ged -EISDIR.
> 
> Under any kernel 3.11 or later, we are supposed to get an unnamed file
> in /tmp. In case the filesystem for /tmp does not support unnamed files,
> we are supposed to get EOPNOTSUPP.

Actually, -EISDIR is valid error when underlying system doesn't support O_TMPFILE.
See man openat or the kernel definition for O_TMPFILE.

Regardless, I'm submitting a patch to properly translate the O_TMPFILE.

Riku

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [Bug 1709170] [PATCH] linux-user: fix O_TMPFILE handling
  2017-08-07 20:18 [Qemu-devel] [Bug 1709170] [NEW] QEMU fails to honor O_TMPFILE Thiago Macieira
  2017-08-08  6:47 ` [Qemu-devel] [Bug 1709170] " Riku Voipio
  2017-08-08 13:19 ` [Qemu-devel] [Bug 1709170] [NEW] " Riku Voipio
@ 2017-08-08 13:21 ` Riku Voipio
  2017-08-08 21:56 ` [Qemu-devel] [Bug 1709170] Re: QEMU fails to honor O_TMPFILE Thiago Macieira
  2017-12-15 15:36 ` Thomas Huth
  4 siblings, 0 replies; 6+ messages in thread
From: Riku Voipio @ 2017-08-08 13:21 UTC (permalink / raw)
  To: qemu-devel

Since O_TMPFILE might differ between guest and host,
add it to the bitmask_transtbl. While at it, fix the definitions
of O_DIRECTORY etc on arm64, which are identical to arm32 according
to kernel sources.

This fixes open14 and openat03 ltp testcases.

Fixes: https://bugs.launchpad.net/qemu/+bug/1709170

---
 linux-user/strace.c       | 4 ++++
 linux-user/syscall.c      | 3 +++
 linux-user/syscall_defs.h | 8 +++++++-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/linux-user/strace.c b/linux-user/strace.c
index d821d165ff..bd897a3f20 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -838,6 +838,10 @@ UNUSED static struct flags open_flags[] = {
 #ifdef O_PATH
     FLAG_TARGET(O_PATH),
 #endif
+#ifdef O_TMPFILE
+    FLAG_TARGET(O_TMPFILE),
+    FLAG_TARGET(__O_TMPFILE),
+#endif
     FLAG_END,
 };
 
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 54343c06be..b3aa8099b4 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -342,6 +342,9 @@ static bitmask_transtbl fcntl_flags_tbl[] = {
 #if defined(O_PATH)
   { TARGET_O_PATH,      TARGET_O_PATH,      O_PATH,      O_PATH       },
 #endif
+#if defined(O_TMPFILE)
+  { TARGET_O_TMPFILE,   TARGET_O_TMPFILE,   O_TMPFILE,   O_TMPFILE    },
+#endif
   /* Don't terminate the list prematurely on 64-bit host+guest.  */
 #if TARGET_O_LARGEFILE != 0 || O_LARGEFILE != 0
   { TARGET_O_LARGEFILE, TARGET_O_LARGEFILE, O_LARGEFILE, O_LARGEFILE, },
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 40c5027e93..6e2287e918 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2416,7 +2416,7 @@ struct target_statfs64 {
 #define TARGET_O_CLOEXEC     010000000
 #define TARGET___O_SYNC      000100000
 #define TARGET_O_PATH        020000000
-#elif defined(TARGET_ARM) || defined(TARGET_M68K)
+#elif defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_AARCH64)
 #define TARGET_O_DIRECTORY      040000 /* must be a directory */
 #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
 #define TARGET_O_DIRECT        0200000 /* direct disk access hint */
@@ -2513,6 +2513,12 @@ struct target_statfs64 {
 #ifndef TARGET_O_PATH
 #define TARGET_O_PATH        010000000
 #endif
+#ifndef TARGET___O_TMPFILE
+#define TARGET___O_TMPFILE   020000000
+#endif
+#ifndef TARGET_O_TMPFILE
+#define TARGET_O_TMPFILE     (TARGET___O_TMPFILE | TARGET_O_DIRECTORY)
+#endif
 #ifndef TARGET_O_NDELAY
 #define TARGET_O_NDELAY  TARGET_O_NONBLOCK
 #endif
-- 
2.11.0

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1709170

Title:
  QEMU fails to honor O_TMPFILE

Status in QEMU:
  New

Bug description:
  When making a call like

    open("/tmp", O_TMPFILE | O_RDWR);

  under QEMU, we ged -EISDIR.

  Under any kernel 3.11 or later, we are supposed to get an unnamed file
  in /tmp. In case the filesystem for /tmp does not support unnamed
  files, we are supposed to get EOPNOTSUPP.

  [I don't know the QEMU version, since this happened in a system I
  don't have access to]

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1709170/+subscriptions

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [Bug 1709170] Re: QEMU fails to honor O_TMPFILE
  2017-08-07 20:18 [Qemu-devel] [Bug 1709170] [NEW] QEMU fails to honor O_TMPFILE Thiago Macieira
                   ` (2 preceding siblings ...)
  2017-08-08 13:21 ` [Qemu-devel] [Bug 1709170] [PATCH] linux-user: fix O_TMPFILE handling Riku Voipio
@ 2017-08-08 21:56 ` Thiago Macieira
  2017-12-15 15:36 ` Thomas Huth
  4 siblings, 0 replies; 6+ messages in thread
From: Thiago Macieira @ 2017-08-08 21:56 UTC (permalink / raw)
  To: qemu-devel

It was a Yocto 2.0 sysroot running on an Ubuntu 16.04 host.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1709170

Title:
  QEMU fails to honor O_TMPFILE

Status in QEMU:
  New

Bug description:
  When making a call like

    open("/tmp", O_TMPFILE | O_RDWR);

  under QEMU, we ged -EISDIR.

  Under any kernel 3.11 or later, we are supposed to get an unnamed file
  in /tmp. In case the filesystem for /tmp does not support unnamed
  files, we are supposed to get EOPNOTSUPP.

  [I don't know the QEMU version, since this happened in a system I
  don't have access to]

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1709170/+subscriptions

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [Bug 1709170] Re: QEMU fails to honor O_TMPFILE
  2017-08-07 20:18 [Qemu-devel] [Bug 1709170] [NEW] QEMU fails to honor O_TMPFILE Thiago Macieira
                   ` (3 preceding siblings ...)
  2017-08-08 21:56 ` [Qemu-devel] [Bug 1709170] Re: QEMU fails to honor O_TMPFILE Thiago Macieira
@ 2017-12-15 15:36 ` Thomas Huth
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2017-12-15 15:36 UTC (permalink / raw)
  To: qemu-devel

Fix has been released with QEMU 2.11:
https://git.qemu.org/?p=qemu.git;a=commitdiff;h=5f9cee46cd4ec4600e1a

** Changed in: qemu
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1709170

Title:
  QEMU fails to honor O_TMPFILE

Status in QEMU:
  Fix Released

Bug description:
  When making a call like

    open("/tmp", O_TMPFILE | O_RDWR);

  under QEMU, we ged -EISDIR.

  Under any kernel 3.11 or later, we are supposed to get an unnamed file
  in /tmp. In case the filesystem for /tmp does not support unnamed
  files, we are supposed to get EOPNOTSUPP.

  [I don't know the QEMU version, since this happened in a system I
  don't have access to]

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1709170/+subscriptions

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-12-15 15:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-07 20:18 [Qemu-devel] [Bug 1709170] [NEW] QEMU fails to honor O_TMPFILE Thiago Macieira
2017-08-08  6:47 ` [Qemu-devel] [Bug 1709170] " Riku Voipio
2017-08-08 13:19 ` [Qemu-devel] [Bug 1709170] [NEW] " Riku Voipio
2017-08-08 13:21 ` [Qemu-devel] [Bug 1709170] [PATCH] linux-user: fix O_TMPFILE handling Riku Voipio
2017-08-08 21:56 ` [Qemu-devel] [Bug 1709170] Re: QEMU fails to honor O_TMPFILE Thiago Macieira
2017-12-15 15:36 ` Thomas Huth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).