[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [Bug 1716292] Re: User mode emulation returns wrong value f
From: |
Thomas Huth |
Subject: |
[Qemu-devel] [Bug 1716292] Re: User mode emulation returns wrong value for write(fd, NULL, 0) |
Date: |
Wed, 12 Dec 2018 09:21:23 -0000 |
** Changed in: qemu
Status: Fix Committed => 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/1716292
Title:
User mode emulation returns wrong value for write(fd, NULL, 0)
Status in QEMU:
Fix Released
Bug description:
QEMU version: latest master (fcea73709b966a7ded9efa7b106ea50c7fe9025c)
OS version: Ubuntu 14.04.5
Configured with: ../configure --target-list=x86_64-linux-user
QEMU Linux usermode emulation does not handle write() syscalls with
zero length and a null pointer correctly: on Linux this returns 0, but
in emulation this returns -1.
I ran into this while using an aarch64 abuild-tar from Alpine Linux in
user-mode emulation; here's the minimized reproduction test case:
address@hidden:/tmp$ cat writezerobytes.c
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int main() {
ssize_t ret = write(STDOUT_FILENO, NULL, 0);
fprintf(stderr, "write returned %ld\n", ret);
return 0;
}
address@hidden:/tmp$ gcc -o writezerobytes writezerobytes.c
address@hidden:/tmp$ uname -a
Linux zhuowei-tablet 3.13.0-129-generic #178-Ubuntu SMP Fri Aug 11 12:48:20
UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
address@hidden:/tmp$ ./writezerobytes
write returned 0
address@hidden:/tmp$
/media/zhuowei/redhd/docs/repos/qemu/build4/x86_64-linux-user/qemu-x86_64
./writezerobytes
write returned -1
address@hidden:/tmp$
/media/zhuowei/redhd/docs/repos/qemu/build4/x86_64-linux-user/qemu-x86_64
--version
qemu-x86_64 version 2.10.50 (v2.10.0-471-gfcea737-dirty)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1716292/+subscriptions
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [Bug 1716292] Re: User mode emulation returns wrong value for write(fd, NULL, 0),
Thomas Huth <=