All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1704658] [NEW] O_CLOEXEC not handled in dup3 system call in user mode
@ 2017-07-16 16:17 Bruno Haible
  2017-07-16 16:18 ` [Qemu-devel] [Bug 1704658] " Bruno Haible
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Bruno Haible @ 2017-07-16 16:17 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

In qemu user mode, for hppa and sparc64 targets, the parameter of the
dup3 is not passed correctly when it contains the O_CLOEXEC flag.

When the attached program runs, the expected output is:
errno=9=EBADF

How to reproduce on hppa:
- Compile the program: hppa-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-hppa
- Set environment variables for running qemu-hppa.
- ~/inst-qemu/2.9.0/bin/qemu-hppa testdup3-hppa
errno=22=EINVAL
testdup3.c:54: assertion 'errno == EBADF' failed

How to reproduce on sparc64:
- Compile the program: sparc64-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-sparc64
- Set environment variables for running qemu-sparc64.
- ~/inst-qemu/2.9.0/bin/qemu-sparc64 testdup3-sparc64
errno=22=EINVAL
testdup3.c:54: assertion 'errno == EBADF' failed

** Affects: qemu
     Importance: Undecided
         Status: New

** Attachment added: "source code of test program"
   https://bugs.launchpad.net/bugs/1704658/+attachment/4915665/+files/testdup3.c

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

Title:
  O_CLOEXEC not handled in dup3 system call in user mode

Status in QEMU:
  New

Bug description:
  In qemu user mode, for hppa and sparc64 targets, the parameter of the
  dup3 is not passed correctly when it contains the O_CLOEXEC flag.

  When the attached program runs, the expected output is:
  errno=9=EBADF

  How to reproduce on hppa:
  - Compile the program: hppa-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-hppa
  - Set environment variables for running qemu-hppa.
  - ~/inst-qemu/2.9.0/bin/qemu-hppa testdup3-hppa
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

  How to reproduce on sparc64:
  - Compile the program: sparc64-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-sparc64
  - Set environment variables for running qemu-sparc64.
  - ~/inst-qemu/2.9.0/bin/qemu-sparc64 testdup3-sparc64
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

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

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

* [Qemu-devel] [Bug 1704658] Re: O_CLOEXEC not handled in dup3 system call in user mode
  2017-07-16 16:17 [Qemu-devel] [Bug 1704658] [NEW] O_CLOEXEC not handled in dup3 system call in user mode Bruno Haible
@ 2017-07-16 16:18 ` Bruno Haible
  2017-07-16 16:19 ` Bruno Haible
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Bruno Haible @ 2017-07-16 16:18 UTC (permalink / raw)
  To: qemu-devel

** Attachment added: "Statically compiled test program for hppa"
   https://bugs.launchpad.net/qemu/+bug/1704658/+attachment/4915666/+files/testdup3-hppa

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

Title:
  O_CLOEXEC not handled in dup3 system call in user mode

Status in QEMU:
  New

Bug description:
  In qemu user mode, for hppa and sparc64 targets, the parameter of the
  dup3 is not passed correctly when it contains the O_CLOEXEC flag.

  When the attached program runs, the expected output is:
  errno=9=EBADF

  How to reproduce on hppa:
  - Compile the program: hppa-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-hppa
  - Set environment variables for running qemu-hppa.
  - ~/inst-qemu/2.9.0/bin/qemu-hppa testdup3-hppa
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

  How to reproduce on sparc64:
  - Compile the program: sparc64-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-sparc64
  - Set environment variables for running qemu-sparc64.
  - ~/inst-qemu/2.9.0/bin/qemu-sparc64 testdup3-sparc64
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

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

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

* [Qemu-devel] [Bug 1704658] Re: O_CLOEXEC not handled in dup3 system call in user mode
  2017-07-16 16:17 [Qemu-devel] [Bug 1704658] [NEW] O_CLOEXEC not handled in dup3 system call in user mode Bruno Haible
  2017-07-16 16:18 ` [Qemu-devel] [Bug 1704658] " Bruno Haible
@ 2017-07-16 16:19 ` Bruno Haible
  2017-07-16 16:23 ` Bruno Haible
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Bruno Haible @ 2017-07-16 16:19 UTC (permalink / raw)
  To: qemu-devel

** Attachment added: "Statically compiled test program for sparc64"
   https://bugs.launchpad.net/qemu/+bug/1704658/+attachment/4915667/+files/testdup3-sparc64

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

Title:
  O_CLOEXEC not handled in dup3 system call in user mode

Status in QEMU:
  New

Bug description:
  In qemu user mode, for hppa and sparc64 targets, the parameter of the
  dup3 is not passed correctly when it contains the O_CLOEXEC flag.

  When the attached program runs, the expected output is:
  errno=9=EBADF

  How to reproduce on hppa:
  - Compile the program: hppa-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-hppa
  - Set environment variables for running qemu-hppa.
  - ~/inst-qemu/2.9.0/bin/qemu-hppa testdup3-hppa
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

  How to reproduce on sparc64:
  - Compile the program: sparc64-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-sparc64
  - Set environment variables for running qemu-sparc64.
  - ~/inst-qemu/2.9.0/bin/qemu-sparc64 testdup3-sparc64
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

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

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

* [Qemu-devel] [Bug 1704658] Re: O_CLOEXEC not handled in dup3 system call in user mode
  2017-07-16 16:17 [Qemu-devel] [Bug 1704658] [NEW] O_CLOEXEC not handled in dup3 system call in user mode Bruno Haible
  2017-07-16 16:18 ` [Qemu-devel] [Bug 1704658] " Bruno Haible
  2017-07-16 16:19 ` Bruno Haible
@ 2017-07-16 16:23 ` Bruno Haible
  2017-08-31 22:07 ` Bruno Haible
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Bruno Haible @ 2017-07-16 16:23 UTC (permalink / raw)
  To: qemu-devel

I see this bug for hppa, sparc64.
I don't see it for m68k, mips, mips64, powerpc, powerpc64.
Most likely because the binary values of O_CLOEXEC on hppa and sparc64 are different than on other platforms. Looking in the glibc source code:

$ grep -r 'define.*O_CLOEXEC' glibc
glibc/bits/fcntl.h:# define O_CLOEXEC   0x00400000      /* Set close_on_exec.  */
glibc/sysdeps/mach/hurd/bits/fcntl.h:# define O_CLOEXEC 0x00400000 /* Set FD_CLOEXEC.  */
glibc/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h:#define __O_CLOEXEC    0x400000 /* Set close_on_exit.  */
glibc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h:# define __O_CLOEXEC   02000000
glibc/sysdeps/unix/sysv/linux/bits/fcntl-linux.h:# define O_CLOEXEC     __O_CLOEXEC     /* Set close_on_exec.  */
glibc/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h:#define __O_CLOEXEC     010000000 /* Set close_on_exec.  */
glibc/sysdeps/unix/sysv/linux/microblaze/bits/fcntl.h:#define __O_CLOEXEC        02000000       /* Set close_on_exec.  */
glibc/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h:#define __O_CLOEXEC    010000000 /* Set close_on_exec.  */
glibc/sysdeps/nacl/bits/fcntl.h:# define O_CLOEXEC      02000000        /* Set close_on_exec.  */

So, what's missing is probably that the O_CLOEXEC of the target platform
gets mapped to O_CLOEXEC of the host platform, during the dup3 system
call emulation.

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

Title:
  O_CLOEXEC not handled in dup3 system call in user mode

Status in QEMU:
  New

Bug description:
  In qemu user mode, for hppa and sparc64 targets, the parameter of the
  dup3 is not passed correctly when it contains the O_CLOEXEC flag.

  When the attached program runs, the expected output is:
  errno=9=EBADF

  How to reproduce on hppa:
  - Compile the program: hppa-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-hppa
  - Set environment variables for running qemu-hppa.
  - ~/inst-qemu/2.9.0/bin/qemu-hppa testdup3-hppa
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

  How to reproduce on sparc64:
  - Compile the program: sparc64-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-sparc64
  - Set environment variables for running qemu-sparc64.
  - ~/inst-qemu/2.9.0/bin/qemu-sparc64 testdup3-sparc64
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

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

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

* [Qemu-devel] [Bug 1704658] Re: O_CLOEXEC not handled in dup3 system call in user mode
  2017-07-16 16:17 [Qemu-devel] [Bug 1704658] [NEW] O_CLOEXEC not handled in dup3 system call in user mode Bruno Haible
                   ` (2 preceding siblings ...)
  2017-07-16 16:23 ` Bruno Haible
@ 2017-08-31 22:07 ` Bruno Haible
  2017-12-15  6:26 ` Bruno Haible
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Bruno Haible @ 2017-08-31 22:07 UTC (permalink / raw)
  To: qemu-devel

The behaviour in qemu-2.10 is the same as in qemu-2.9.

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

Title:
  O_CLOEXEC not handled in dup3 system call in user mode

Status in QEMU:
  New

Bug description:
  In qemu user mode, for hppa and sparc64 targets, the parameter of the
  dup3 is not passed correctly when it contains the O_CLOEXEC flag.

  When the attached program runs, the expected output is:
  errno=9=EBADF

  How to reproduce on hppa:
  - Compile the program: hppa-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-hppa
  - Set environment variables for running qemu-hppa.
  - ~/inst-qemu/2.9.0/bin/qemu-hppa testdup3-hppa
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

  How to reproduce on sparc64:
  - Compile the program: sparc64-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-sparc64
  - Set environment variables for running qemu-sparc64.
  - ~/inst-qemu/2.9.0/bin/qemu-sparc64 testdup3-sparc64
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

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

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

* [Qemu-devel] [Bug 1704658] Re: O_CLOEXEC not handled in dup3 system call in user mode
  2017-07-16 16:17 [Qemu-devel] [Bug 1704658] [NEW] O_CLOEXEC not handled in dup3 system call in user mode Bruno Haible
                   ` (3 preceding siblings ...)
  2017-08-31 22:07 ` Bruno Haible
@ 2017-12-15  6:26 ` Bruno Haible
  2017-12-15 15:21 ` Peter Maydell
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Bruno Haible @ 2017-12-15  6:26 UTC (permalink / raw)
  To: qemu-devel

The behaviour in qemu-2.11 is the same as in qemu-2.9.

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

Title:
  O_CLOEXEC not handled in dup3 system call in user mode

Status in QEMU:
  New

Bug description:
  In qemu user mode, for hppa and sparc64 targets, the parameter of the
  dup3 is not passed correctly when it contains the O_CLOEXEC flag.

  When the attached program runs, the expected output is:
  errno=9=EBADF

  How to reproduce on hppa:
  - Compile the program: hppa-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-hppa
  - Set environment variables for running qemu-hppa.
  - ~/inst-qemu/2.9.0/bin/qemu-hppa testdup3-hppa
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

  How to reproduce on sparc64:
  - Compile the program: sparc64-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-sparc64
  - Set environment variables for running qemu-sparc64.
  - ~/inst-qemu/2.9.0/bin/qemu-sparc64 testdup3-sparc64
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

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

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

* [Qemu-devel] [Bug 1704658] Re: O_CLOEXEC not handled in dup3 system call in user mode
  2017-07-16 16:17 [Qemu-devel] [Bug 1704658] [NEW] O_CLOEXEC not handled in dup3 system call in user mode Bruno Haible
                   ` (4 preceding siblings ...)
  2017-12-15  6:26 ` Bruno Haible
@ 2017-12-15 15:21 ` Peter Maydell
  2018-04-26  6:05 ` Thomas Huth
  2018-04-27 12:27 ` Bruno Haible
  7 siblings, 0 replies; 9+ messages in thread
From: Peter Maydell @ 2017-12-15 15:21 UTC (permalink / raw)
  To: qemu-devel

Should be fixed by http://patchwork.ozlabs.org/patch/849226/

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

Title:
  O_CLOEXEC not handled in dup3 system call in user mode

Status in QEMU:
  New

Bug description:
  In qemu user mode, for hppa and sparc64 targets, the parameter of the
  dup3 is not passed correctly when it contains the O_CLOEXEC flag.

  When the attached program runs, the expected output is:
  errno=9=EBADF

  How to reproduce on hppa:
  - Compile the program: hppa-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-hppa
  - Set environment variables for running qemu-hppa.
  - ~/inst-qemu/2.9.0/bin/qemu-hppa testdup3-hppa
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

  How to reproduce on sparc64:
  - Compile the program: sparc64-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-sparc64
  - Set environment variables for running qemu-sparc64.
  - ~/inst-qemu/2.9.0/bin/qemu-sparc64 testdup3-sparc64
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

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

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

* [Qemu-devel] [Bug 1704658] Re: O_CLOEXEC not handled in dup3 system call in user mode
  2017-07-16 16:17 [Qemu-devel] [Bug 1704658] [NEW] O_CLOEXEC not handled in dup3 system call in user mode Bruno Haible
                   ` (5 preceding siblings ...)
  2017-12-15 15:21 ` Peter Maydell
@ 2018-04-26  6:05 ` Thomas Huth
  2018-04-27 12:27 ` Bruno Haible
  7 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2018-04-26  6:05 UTC (permalink / raw)
  To: qemu-devel

Fix has been included here:
https://git.qemu.org/?p=qemu.git;a=commitdiff;h=10fa993aae539fa8d0da1d

** 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/1704658

Title:
  O_CLOEXEC not handled in dup3 system call in user mode

Status in QEMU:
  Fix Released

Bug description:
  In qemu user mode, for hppa and sparc64 targets, the parameter of the
  dup3 is not passed correctly when it contains the O_CLOEXEC flag.

  When the attached program runs, the expected output is:
  errno=9=EBADF

  How to reproduce on hppa:
  - Compile the program: hppa-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-hppa
  - Set environment variables for running qemu-hppa.
  - ~/inst-qemu/2.9.0/bin/qemu-hppa testdup3-hppa
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

  How to reproduce on sparc64:
  - Compile the program: sparc64-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-sparc64
  - Set environment variables for running qemu-sparc64.
  - ~/inst-qemu/2.9.0/bin/qemu-sparc64 testdup3-sparc64
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

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

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

* [Qemu-devel] [Bug 1704658] Re: O_CLOEXEC not handled in dup3 system call in user mode
  2017-07-16 16:17 [Qemu-devel] [Bug 1704658] [NEW] O_CLOEXEC not handled in dup3 system call in user mode Bruno Haible
                   ` (6 preceding siblings ...)
  2018-04-26  6:05 ` Thomas Huth
@ 2018-04-27 12:27 ` Bruno Haible
  7 siblings, 0 replies; 9+ messages in thread
From: Bruno Haible @ 2018-04-27 12:27 UTC (permalink / raw)
  To: qemu-devel

Confirmed: It's fixed in qemu-2.12.

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

Title:
  O_CLOEXEC not handled in dup3 system call in user mode

Status in QEMU:
  Fix Released

Bug description:
  In qemu user mode, for hppa and sparc64 targets, the parameter of the
  dup3 is not passed correctly when it contains the O_CLOEXEC flag.

  When the attached program runs, the expected output is:
  errno=9=EBADF

  How to reproduce on hppa:
  - Compile the program: hppa-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-hppa
  - Set environment variables for running qemu-hppa.
  - ~/inst-qemu/2.9.0/bin/qemu-hppa testdup3-hppa
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

  How to reproduce on sparc64:
  - Compile the program: sparc64-linux-gnu-gcc-5 -O -Wall -static testdup3.c -o testdup3-sparc64
  - Set environment variables for running qemu-sparc64.
  - ~/inst-qemu/2.9.0/bin/qemu-sparc64 testdup3-sparc64
  errno=22=EINVAL
  testdup3.c:54: assertion 'errno == EBADF' failed

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

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

end of thread, other threads:[~2018-04-27 12:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-16 16:17 [Qemu-devel] [Bug 1704658] [NEW] O_CLOEXEC not handled in dup3 system call in user mode Bruno Haible
2017-07-16 16:18 ` [Qemu-devel] [Bug 1704658] " Bruno Haible
2017-07-16 16:19 ` Bruno Haible
2017-07-16 16:23 ` Bruno Haible
2017-08-31 22:07 ` Bruno Haible
2017-12-15  6:26 ` Bruno Haible
2017-12-15 15:21 ` Peter Maydell
2018-04-26  6:05 ` Thomas Huth
2018-04-27 12:27 ` Bruno Haible

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.