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