aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-03-13win32: replace closesocket() with close() wrapperMarc-André Lureau
Use a close() wrapper instead, so that we don't need to worry about closesocket() vs close() anymore, let's hope. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-17-marcandre.lureau@redhat.com>
2023-03-13os-posix: remove useless ioctlsocket() defineMarc-André Lureau
The API is specific to win32. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230221124802.4103554-16-marcandre.lureau@redhat.com>
2023-03-13win32: avoid mixing SOCKET and file descriptor spaceMarc-André Lureau
Until now, a win32 SOCKET handle is often cast to an int file descriptor, as this is what other OS use for sockets. When necessary, QEMU eventually queries whether it's a socket with the help of fd_is_socket(). However, there is no guarantee of conflict between the fd and SOCKET space. Such conflict would have surprising consequences, we shouldn't mix them. Also, it is often forgotten that SOCKET must be closed with closesocket(), and not close(). Instead, let's make the win32 socket wrapper functions return and take a file descriptor, and let util/ wrappers do the fd/SOCKET conversion as necessary. A bit of adaptation is necessary in io/ as well. Unfortunately, we can't drop closesocket() usage, despite _open_osfhandle() documentation claiming transfer of ownership, testing shows bad behaviour if you forget to call closesocket(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-15-marcandre.lureau@redhat.com>
2023-03-13slirp: open-code qemu_socket_(un)select()Marc-André Lureau
We are about to make the QEMU socket API use file-descriptor space only, but libslirp gives us SOCKET as fd, still. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-14-marcandre.lureau@redhat.com>
2023-03-13slirp: unregister the win32 SOCKETMarc-André Lureau
Presumably, this is what should happen when the SOCKET is to be removed. (it probably worked until now because closesocket() does it implicitly, but we never now how the slirp library could use the SOCKET later) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-13-marcandre.lureau@redhat.com>
2023-03-13main-loop: remove qemu_fd_register(), win32/slirp/socket specificMarc-André Lureau
Open-code the socket registration where it's needed, to avoid artificially used or unclear generic interface. Furthermore, the following patches are going to make socket handling use FD-only inside QEMU, but we need to handle win32 SOCKET from libslirp. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-12-marcandre.lureau@redhat.com>
2023-03-13aio/win32: aio_set_fd_handler() only supports SOCKETMarc-André Lureau
Let's check if the argument is actually a SOCKET, else report an error and return. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-10-marcandre.lureau@redhat.com>
2023-03-13aio: make aio_set_fd_poll() static to aio-posix.cMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-9-marcandre.lureau@redhat.com>
2023-03-13win32/socket: introduce qemu_socket_unselect() helperMarc-André Lureau
A more explicit version of qemu_socket_select() with no events. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-8-marcandre.lureau@redhat.com>
2023-03-13win32/socket: introduce qemu_socket_select() helperMarc-André Lureau
This is a wrapper for WSAEventSelect, with Error handling. By default, it will produce a warning, so callers don't have to be modified now, and yet we can spot potential mis-use. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-7-marcandre.lureau@redhat.com>
2023-03-13error: add global &error_warn destinationMarc-André Lureau
This can help debugging issues or develop, when error handling is introduced. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-6-marcandre.lureau@redhat.com>
2023-03-13tests: add test-error-reportMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-5-marcandre.lureau@redhat.com>
2023-03-13io: use closesocket()Marc-André Lureau
Because they are actually sockets... Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20230221124802.4103554-4-marcandre.lureau@redhat.com>
2023-03-13tests: use closesocket()Marc-André Lureau
Because they are actually sockets... Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20230221124802.4103554-3-marcandre.lureau@redhat.com>
2023-03-13util: drop qemu_fork()Marc-André Lureau
Fortunately, qemu_fork() is no longer used since commit a95570e3e4d6 ("io/command: use glib GSpawn, instead of open-coding fork/exec"). (GSpawn uses posix_spawn() whenever possible instead) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230221124802.4103554-2-marcandre.lureau@redhat.com>
2023-03-12Merge tag 'linux-user-for-8.0-pull-request' of ↵Peter Maydell
https://gitlab.com/laurent_vivier/qemu into staging Pull request linux-user 20230308-v2 Fix gdt on i386/x86_64 Handle traps on sparc Add translation for argument of msync Emulate CLONE_PIDFD flag in clone handle netlink flag NLA_F_NESTED fix sockaddr_in6 endianness Fix brk() to release pages fill out task state in /proc/self/stat add support for xtensa FDPIC Fix unaligned memory access in prlimit64 syscall add target to host netlink conversions fix timerfd read endianness conversion Fix access to /proc/self/exe Add strace for prlimit64() syscall # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmQLqmMSHGxhdXJlbnRA # dml2aWVyLmV1AAoJEPMMOL0/L748e+cP/3XYMvPbExNi09idDvgzzBrFFHgnkCnK # WAV/laxjHSJkzRNK06jD5KN/G2Osy587GXAWLaN76Y8mYMNJs5x3wwlBrJm0RyeJ # mWeETJOjxsFjW1+5LKhYv6fwiDxQcyJUoRKzJI27fYgDS+H+zIpa+uhy82Ah543z # i/HPyerp25TWAuVyR6mQICt7cne+4yjhtcjg0GXmnvm2+UVp54FGjesjwpSdbALl # OKdCre/JaNOkKoaRSsxm0UhNEyQarJIEf/dv0fTjsEpvNX2SMuLUGCm+n23wjXGN # fdnSGkoVe8hHxBtG80Zx8AMfKEmJoVsQw9rSg4HwQKOyrYPnLhHjb8ln43X+f3MN # gq9lDBIxH82LH2Q5JqQQe7S2UJycpYb+qj0xm7llH7Wl9VVKG6hRX/Cd7I1PQLEv # baPIrtye5TuR6uo0kn6HBB+Hd9RNu2PPHelmEFIGEuNaAPkyOt4FhKFIE/j0BTcg # mFVCNj6Os805ks0sjIBvpTU1DBtuqpLxdvvHOwxYKCNThTl70wfHJJEjumfvZ4qT # T+me7hRsd+8v1rRjxYGuJn2gqC7JL8miuJCYlZkn2DfMAunmF00U5ULe9KiCJ8V3 # kDfvO+CdnIN4MSlbtwt+eRSFCmJGGkzZ/jshVxPF3ZVirFu/undphYQnaEZDH+Xd # KsPOh8MekMgJ # =e55j # -----END PGP SIGNATURE----- # gpg: Signature made Fri 10 Mar 2023 22:08:35 GMT # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * tag 'linux-user-for-8.0-pull-request' of https://gitlab.com/laurent_vivier/qemu: (28 commits) linux-user: fix bug about incorrect base addresss of gdt on i386 and x86_64 linux-user/sparc: Handle tag overflow traps linux-user/sparc: Handle floating-point exceptions linux-user/sparc: Handle unimplemented flush trap linux-user/sparc: Handle coprocessor disabled trap linux-user/sparc: Handle privilidged action trap linux-user/sparc: Handle priviledged opcode trap linux-user/sparc: Handle getcc, setcc, getpsr traps linux-user/sparc: Handle division by zero traps linux-user/sparc: Handle software breakpoint trap linux-user/sparc: Fix sparc64_{get, set}_context traps linux-user/sparc: Tidy window spill/fill traps linux-user/sparc: Use TT_TRAP for flush windows linux-user/sparc: Tidy syscall error return linux-user/sparc: Tidy syscall trap linux-user: Emulate CLONE_PIDFD flag in clone() linux-user: Add translation for argument of msync() linux-user: handle netlink flag NLA_F_NESTED linux-user: fix sockaddr_in6 endianness linux-user: Add strace for prlimit64() syscall ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-03-12Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into stagingPeter Maydell
Block layer patches - fuse: Fix fallocate(PUNCH_HOLE) to zero out the range - qed: remove spurious BDRV_POLL_WHILE() # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmQLbtURHGt3b2xmQHJl # ZGhhdC5jb20ACgkQfwmycsiPL9YekQ//SvVXzKbQCNoKJtbkmx9RYSVZt3C19Nfy # +E3vUauBMvO1RA38J+ff3pBp7R2rWu1QQXZCVu0a5bg7R2cYSKs82Ua5Z6SG9KxZ # TZSGw2vsYk5pcRJwUS+4lGkvV4zrUsm7gru5h+aL51YS20AaPfSaa/kKKMuWWabm # O/7ct/gQdiH+8I3d1WpXTE69ZJoH6WK87TUg9HgdQWPwDgam0gbNEjsGjKioCKIz # xuz28v1UufXL2PRIWmPh4X+XSvD81q3adgf+vM5tWOaeAL87Q0eLeyiAI0UrvE64 # X9IGsiDcbM3PaLSlZPborg/yDatWjnnBimbxAMuT7d4pbZXjbYPBOeLR7zPJQ2qQ # x/sFgiAVGiR6pgWIC85E2rIsWfBIEAla/YowZRdNmCO7ar82wBhoGdUQx6nHP18U # eJg50EhX9Fhf5kMt3tZf4AaJzn48QsBA+O7PKbc/DZBLrthOLKzyLM6SusbpBG8g # jFsdlDYMy9dIB6g3BC6fwZAqQNqbEMlU63ZvQzeq5yPpjFyS5H3IGHLzDiYg/9m6 # WdRUM/wQKkq0YwF1OumQ+Uu8ClTJPDi/177+hOyQeIFZao3NgznDtA12rNroYOU2 # pDIff9K9gwOFFNmDDtsjm8h967pF7RJMZylvNilT+7xkMy2kwYdCo76TBYDyN8Kk # aYBIDpWtPps= # =PUFU # -----END PGP SIGNATURE----- # gpg: Signature made Fri 10 Mar 2023 17:54:29 GMT # gpg: using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6 # gpg: issuer "kwolf@redhat.com" # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full] # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * tag 'for-upstream' of https://repo.or.cz/qemu/kevin: qed: remove spurious BDRV_POLL_WHILE() iotests/308: Add test for 'write -zu' block/fuse: Let PUNCH_HOLE write zeroes Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-03-11Merge tag 'pull-gitdm-100323-1' of https://gitlab.com/stsquad/qemu into stagingPeter Maydell
gitdm updates for: - IBM - Facebook - Individual contributors - Ventana # -----BEGIN PGP SIGNATURE----- # # iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmQLUy8ACgkQ+9DbCVqe # KkRCdwf+L7Y0mHKKvxVyfRO2W51HbzUYqzPF6bFgqxqwbL6CRdPw5Ks3RHGV8N6C # Er4MIsVhzLUY7BX+IcHZG1C9/8UrtymY2tUA1Qg5L2NQ/pNvDN9OHA/HXw+JkOq2 # l/l1ZkWmlT0IZwtTrKYHjZnqxMfEOey33y+t623wtMh7Bpj/ZPjYLsYxhhkwobvc # fPFAZ2tukkECFkvylnaoE+3S2g86EY9soZEmeSdOYPtIbeb42o38cTchaAHQnc09 # sQJ1hguRUpwi1Y1CaP3QCqS8TkdV1oObWJ4+ZfHHXmDWfI0yQfbNFBU7bGZkxGkI # i9EKqF+xfdklrqJz9Y7jEjFfetUghA== # =p/39 # -----END PGP SIGNATURE----- # gpg: Signature made Fri 10 Mar 2023 15:56:31 GMT # gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full] # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * tag 'pull-gitdm-100323-1' of https://gitlab.com/stsquad/qemu: contrib/gitdm: add Idan to IBM's group map contrib/gitdm: Add Facebook the domain map contrib/gitdm: add Tsukasa as an individual contributor contrib/gitdm: Add Ventana Micro Systems to the domain map contrib/gitdm: Add VRULL to the domain map Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-03-11Merge tag 'net-pull-request' of https://github.com/jasowang/qemu into stagingPeter Maydell
# -----BEGIN PGP SIGNATURE----- # Version: GnuPG v1 # # iQEcBAABAgAGBQJkCvgFAAoJEO8Ells5jWIRHiUH/jhydpJHIqnAPxHQAwGtmyhb # 9Z52UOzW5V6KxfZJ+bQ4RPFkS2UwcxmeadPHY4zvvJTVBLAgG3QVgP4igj8CXKCI # xRnwMgTNeu655kZQ5P/elTwdBTCJFODk7Egg/bH3H1ZiUhXBhVRhK7q/wMgtlZkZ # Kexo6txCK4d941RNzEh45ZaGhdELE+B+D7cRuQgBs/DXZtJpsyEzBbP8KYSMHuER # AXfWo0YIBYj7X3ek9D6j0pbOkB61vqtYd7W6xV4iDrJCcFBIOspJbbBb1tGCHola # AXo5/OhRmiQnp/c/HTbJIDbrj0sq/r7LxYK4zY1x7UPbewHS9R+wz+FfqSmoBF0= # =056y # -----END PGP SIGNATURE----- # gpg: Signature made Fri 10 Mar 2023 09:27:33 GMT # gpg: using RSA key EF04965B398D6211 # gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" [marginal] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 215D 46F4 8246 689E C77F 3562 EF04 965B 398D 6211 * tag 'net-pull-request' of https://github.com/jasowang/qemu: (44 commits) ebpf: fix compatibility with libbpf 1.0+ docs/system/devices/igb: Add igb documentation tests/avocado: Add igb test igb: Introduce qtest for igb device tests/qtest/libqos/e1000e: Export macreg functions tests/qtest/e1000e-test: Fabricate ethernet header Intrdocue igb device emulation e1000: Split header files pcie: Introduce pcie_sriov_num_vfs net/eth: Introduce EthL4HdrProto e1000e: Implement system clock net/eth: Report if headers are actually present e1000e: Count CRC in Tx statistics e1000: Count CRC in Tx statistics e1000e: Combine rx traces MAINTAINERS: Add e1000e test files MAINTAINERS: Add Akihiko Odaki as a e1000e reviewer e1000e: Do not assert when MSI-X is disabled later hw/net/net_tx_pkt: Check the payload length hw/net/net_tx_pkt: Implement TCP segmentation ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-03-10linux-user: fix bug about incorrect base addresss of gdt on i386 and x86_64fanwj@mail.ustc.edu.cn
On linux user mode, CPUX86State::gdt::base from Different CPUX86State Objects have same value, It is incorrect! Every CPUX86State::gdt::base Must points to independent memory space. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1405 Signed-off-by: fanwenjie <fanwj@mail.ustc.edu.cn> Message-Id: <4172b90.58b08.18631b77860.Coremail.fanwj@mail.ustc.edu.cn> [lv: remove unnecessary casts, split overlong line] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user/sparc: Handle tag overflow trapsRichard Henderson
This trap is raised by taddcctv and tsubcctv insns. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230216054516.1267305-16-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user/sparc: Handle floating-point exceptionsRichard Henderson
Raise SIGFPE for ieee exceptions. The other types, such as FSR_FTT_UNIMPFPOP, should not appear, because we enable normal emulation of missing insns at the start of sparc_cpu_realizefn(). Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230216054516.1267305-15-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user/sparc: Handle unimplemented flush trapRichard Henderson
For sparc64, TT_UNIMP_FLUSH == TT_ILL_INSN, so this is already handled. For sparc32, the kernel uses SKIP_TRAP. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230216054516.1267305-14-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user/sparc: Handle coprocessor disabled trapRichard Henderson
Since qemu does not implement a sparc coprocessor, all such instructions raise this trap. Because of that, we never raise the coprocessor exception trap, which would be vector 0x28. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230216054516.1267305-13-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user/sparc: Handle privilidged action trapRichard Henderson
This is raised by using an %asi < 0x80 in user-mode. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230216054516.1267305-12-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user/sparc: Handle priviledged opcode trapRichard Henderson
For the most part priviledged opcodes are ifdefed out of the user-only sparc translator, which will then incorrectly produce illegal opcode traps. But there are some code paths that properly raise TT_PRIV_INSN, so we must handle it. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230216054516.1267305-11-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user/sparc: Handle getcc, setcc, getpsr trapsRichard Henderson
These are really only meaningful for sparc32, but they're still present for backward compatibility for sparc64. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230216054516.1267305-10-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user/sparc: Handle division by zero trapsRichard Henderson
In addition to the hw trap vector, there is a software trap assigned for older sparc without hw division instructions. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230216054516.1267305-9-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user/sparc: Handle software breakpoint trapRichard Henderson
This is 'ta 1' for both v9 and pre-v9. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230216054516.1267305-8-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user/sparc: Fix sparc64_{get, set}_context trapsRichard Henderson
These traps are present for sparc64 with ilp32, aka sparc32plus. Enabling them means adjusting the defines over in signal.c, and fixing an incorrect usage of abi_ulong when we really meant the full register, target_ulong. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230216054516.1267305-7-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user/sparc: Tidy window spill/fill trapsRichard Henderson
Add some macros to localize the hw difference between v9 and pre-v9. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230216054516.1267305-6-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user/sparc: Use TT_TRAP for flush windowsRichard Henderson
The v9 and pre-v9 code can be unified with this macro. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230216054516.1267305-5-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user/sparc: Tidy syscall error returnRichard Henderson
Reduce ifdefs with #define syscall_cc. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230216054516.1267305-4-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user/sparc: Tidy syscall trapRichard Henderson
Use TT_TRAP. For sparc32, 0x88 is the "Slowaris" system call, currently BAD_TRAP in the kernel's ttable_32.S. For sparc64, 0x110 is tl0_linux32, the sparc32 trap, now folded into the TARGET_ABI32 case via TT_TRAP. For sparc64, there does still exist trap 0x111 as tl0_oldlinux64, which was replaced by 0x16d as tl0_linux64 in 1998. Since no one has noticed, don't bother implementing it now. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230216054516.1267305-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user: Emulate CLONE_PIDFD flag in clone()Helge Deller
Add emulation for the CLONE_PIDFD flag of the clone() syscall. This flag was added in Linux kernel 5.2. Successfully tested on a x86-64 Linux host with hppa-linux target. Can be verified by running the testsuite of the qcoro debian package, which breaks hard and kills the currently logged-in user without this patch. Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <Y4XoJCpvUA1JD7Sj@p100> [lv: define CLONE_PIDFD if it is not] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user: Add translation for argument of msync()Helge Deller
msync() uses the flags MS_ASYNC, MS_INVALIDATE and MS_SYNC, which differ between platforms, specifcally on alpha and hppa. Add a target to host translation for those and wire up a nicer strace output. This fixes the testsuite of the macaulay2 debian package with a hppa-linux guest on a x86-64 host. Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <Y5rMcts4qe15RaVN@p100> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user: handle netlink flag NLA_F_NESTEDMathis Marion
Newer kernel versions require this flag to be present contrary to older ones. Depending on the libnl version it is added or not. Typically when using rtnl_link_inet6_set_addr_gen_mode, the netlink packet generated may contain the following attribute: with libnl 3.4 {nla_len=16, nla_type=IFLA_AF_SPEC}, [ {nla_len=12, nla_type=AF_INET6}, [{nla_len=5, nla_type=IFLA_INET6_ADDR_GEN_MODE}, IN6_ADDR_GEN_MODE_NONE] ] with libnl 3.7 {nla_len=16, nla_type=NLA_F_NESTED|IFLA_AF_SPEC}, [ {nla_len=12, nla_type=NLA_F_NESTED|AF_INET6}, [{nla_len=5, nla_type=IFLA_INET6_ADDR_GEN_MODE}, IN6_ADDR_GEN_MODE_NONE]] ] Masking the type is likely needed in other places. Only the above cases are implemented in this patch. Signed-off-by: Mathis Marion <mathis.marion@silabs.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20230307154256.101528-3-Mathis.Marion@silabs.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user: fix sockaddr_in6 endiannessMathis Marion
The sin6_scope_id field uses the host byte order, so there is a conversion to be made when host and target endianness differ. Signed-off-by: Mathis Marion <mathis.marion@silabs.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230307154256.101528-2-Mathis.Marion@silabs.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user: Add strace for prlimit64() syscallHelge Deller
Add proper prlimit64() strace output. Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20221222190639.124078-1-deller@gmx.de> [lvivier: use print_raw_param64()] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user: Provide print_raw_param64() for 64-bit valuesHelge Deller
Add a new function print_raw_param64() to print 64-bit values in the same way as print_raw_param(). This prevents that qemu_log() is used to work around the problem that print_raw_param() can only print 32-bit values when compiled for 32-bit targets. Additionally convert the existing 64-bit users in print_timespec64(), print_rlimit64() and print_preadwrite64() over to this new function and drop some unneccessary spaces. Suggested-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <Y9lNbFNyRSUhhrHa@p100> [lvivier: remove print_preadwrite64 and print_rlimit64 part] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user: Fix brk() to release pagesHelge Deller
The current brk() implementation does not de-allocate pages if a lower address is given compared to earlier brk() calls. But according to the manpage, brk() shall deallocate memory in this case and currently it breaks a real-world application, specifically building the debian gcl package in qemu-user. Fix this issue by reworking the qemu brk() implementation. Tested with the C-code testcase included in qemu commit 4d1de87c750, and by building debian package of gcl in a hppa-linux guest on a x86-64 host. Signed-off-by: Helge Deller <deller@gmx.de> Message-Id: <Y6gId80ek49TK1xB@p100> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user: fill out task state in /proc/self/statAndreas Schwab
Some programs want to match an actual task state character. Signed-off-by: Andreas Schwab <schwab@suse.de> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <mvmedq2kxoe.fsf@suse.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user: add support for xtensa FDPICMax Filippov
Define xtensa-specific info_is_fdpic and fill in FDPIC-specific registers in the xtensa version of init_thread. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Message-Id: <20230205061230.544451-1-jcmvbkbc@gmail.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user: Fix unaligned memory access in prlimit64 syscallIlya Leoshkevich
target_rlimit64 contains uint64_t fields, so it's 8-byte aligned on some hosts, while some guests may align their respective type on a 4-byte boundary. This may lead to an unaligned access, which is an UB. Fix by defining the fields as abi_ullong. This makes the host alignment match that of the guest, and lets the compiler know that it should emit code that can deal with the guest alignment. While at it, also use __get_user() and __put_user() instead of tswap64(). Fixes: 163a05a8398b ("linux-user: Implement prlimit64 syscall") Reported-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20230224003907.263914-2-iii@linux.ibm.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user: add target to host netlink conversionsMathis Marion
Added conversions for: - IFLA_MTU - IFLA_TXQLEN - IFLA_AF_SPEC AF_INET6 IFLA_INET6_ADDR_GEN_MODE These relate to the libnl functions rtnl_link_set_mtu, rtnl_link_set_txqlen, and rtnl_link_inet6_set_addr_gen_mode. Signed-off-by: Mathis Marion <mathis.marion@silabs.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20230220085822.626798-4-Mathis.Marion@silabs.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user: fix timerfd read endianness conversionMathis Marion
When reading the expiration count from a timerfd, the endianness of the 64bit value read is the one of the host, just as for eventfds. Signed-off-by: Mathis Marion <mathis.marion@silabs.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20230220085822.626798-2-Mathis.Marion@silabs.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10linux-user: Fix access to /proc/self/exeHelge Deller
When accsssing /proc/self/exe from a userspace program, linux-user tries to resolve the name via realpath(), which may fail if the process changed the working directory in the meantime. An example: - a userspace program ist started with ./testprogram - the program runs chdir("/tmp") - then the program calls readlink("/proc/self/exe") - linux-user tries to run realpath("./testprogram") which fails because ./testprogram isn't in /tmp - readlink() will return -ENOENT back to the program Avoid this issue by resolving the full path name of the started process at startup of linux-user and store it in real_exec_path[]. This then simplifies the emulation of readlink() and readlinkat() as well, because they can simply copy the path string to userspace. I noticed this bug because the testsuite of the debian package "pandoc" failed on linux-user while it succeeded on real hardware. The full log is here: https://buildd.debian.org/status/fetch.php?pkg=pandoc&arch=hppa&ver=2.17.1.1-1.1%2Bb1&stamp=1670153210&raw=0 Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20221205113825.20615-1-deller@gmx.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2023-03-10contrib/gitdm: add Idan to IBM's group mapAlex Bennée
According to LinkedIn Idan works at IBM. Please confirm if you want these contributions counted under IBM or as personal contributions. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Idan Horowitz <idan.horowitz@gmail.com> Message-Id: <20221219121914.851488-11-alex.bennee@linaro.org>
2023-03-10contrib/gitdm: Add Facebook the domain mapAlex Bennée
A number of Facebook developers contribute to the project. Peter can you confirm your want pjd.dev contributions counted here or as an individual contributor? Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Cc: Iris Chen <irischenlj@fb.com> Cc: Daniel Müller <muellerd@fb.com> Reviewed-by: Peter Delevoryas <peter@pjd.dev> Message-Id: <20221219121914.851488-9-alex.bennee@linaro.org>
2023-03-10contrib/gitdm: add Tsukasa as an individual contributorAlex Bennée
I wasn't sure if you want to be added as an individual contributor or an academic so please confirm. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Tsukasa OI <research_trasio@irq.a4lg.com> Message-Id: <20221219121914.851488-7-alex.bennee@linaro.org>