Nguyen Dinh Phi and Richard Henderson
2ee80bce4f
linux-user: replace calloc() with g_new0()
...
Use glib allocation as recommended by the coding convention
Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com >
Message-Id: <20240317171747.1642207-1-phind.uet@gmail.com >
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-04-09 07:43:31 -10:00
Richard Henderson
f0907ff4ca
linux-user: Fix waitid return of siginfo_t and rusage
...
The copy back to siginfo_t should be conditional only on arg3,
not the specific values that might have been written.
The copy back to rusage was missing entirely.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2262
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Tested-by: Alex Fan <alex.fan.q@gmail.com >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
2024-04-09 07:43:11 -10:00
Ilya Leoshkevich and Richard Henderson
fa527b44c2
linux-user: Fix shmat(NULL) for h != g
...
In the h != g && shmaddr == NULL && !reserved_va case, target_shmat()
incorrectly mmap()s the initial anonymous range with
MAP_FIXED_NOREPLACE, even though the earlier mmap_find_vma() has
already reserved the respective address range.
Fix by using MAP_FIXED when "mapped", which is set after
mmap_find_vma(), is true.
Fixes: 78bc8ed9a8 ("linux-user: Rewrite target_shmat")
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Message-Id: <20240325192436.561154-4-iii@linux.ibm.com >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-03-26 18:20:36 -10:00
Ilya Leoshkevich and Richard Henderson
e6763d7dfc
linux-user: Fix shmat() strace
...
The indices of arguments passed to print_shmat() are all off-by-1,
because arg1 is the ipc() command. Fix them.
New output for linux-shmat-maps test:
3501769 shmat(4784214,0x0000000000800000,SHM_RND) = 0
Fixes: 9f7c97324c ("linux-user: Add strace for shmat")
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Message-Id: <20240325192436.561154-3-iii@linux.ibm.com >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-03-26 18:20:36 -10:00
Ilya Leoshkevich and Richard Henderson
b9f38374ac
linux-user: Fix semctl() strace
...
The indices of arguments used with semctl() are all off-by-1, because
arg1 is the ipc() command. Fix them. While at it, reuse print_semctl().
New output (for a small test program):
3540333 semctl(999,888,SEM_INFO,0x00007fe5051ee9a0) = -1 errno=14 (Bad address)
Fixes: 7ccfb2eb5f ("Fix warnings that would be caused by gcc flag -Wwrite-strings")
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Message-Id: <20240325192436.561154-2-iii@linux.ibm.com >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-03-26 18:20:36 -10:00
Peter Maydell
ba49d760eb
Merge tag 'pull-maintainer-final-130324-1' of https://gitlab.com/stsquad/qemu into staging
...
final updates for 9.0 (testing, gdbstub):
- fix the over rebuilding of test VMs
- support Xfer:siginfo:read in gdbstub
- fix double close() in gdbstub
# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmXxkb0ACgkQ+9DbCVqe
# KkSw9wf+K+3kJYaZ2unEFku3Y6f4Z9XkrZCsFQFVNIJQgpYVc6peQyLUB1pZwzZc
# yoQhmTIgej16iRZc7gEcJhFl2zlX2vulE/m+wiaR0Chv3E2r510AGn4aWl+GLB9+
# /WduHaz1NobPW4JWaarxespa84Re8QZQgqkHX4nwYd++FW63E4uxydL4F1nmSNca
# eTA6RwS48h4wqPzHBX72hYTRUnYrDUSSGCGUDzK3NHumuPi+AQ77GLRMO0MTYFfy
# hWriapogCmghY+Xtn++eUIwDyh1CCnUT6Ntf5Qj06bZ+f6eaTwINM8QWhj9mxYX+
# 5/F5Q4JJDqRPYw/hF4wYXRsiZxTYFw==
# =BOWW
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 13 Mar 2024 11:45:01 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-maintainer-final-130324-1' of https://gitlab.com/stsquad/qemu :
gdbstub: Fix double close() of the follow-fork-mode socket
tests/tcg: Add multiarch test for Xfer:siginfo:read stub
gdbstub: Add Xfer:siginfo:read stub
gdbstub: Save target's siginfo
linux-user: Move tswap_siginfo out of target code
gdbstub: Rename back gdb_handlesig
tests/vm: ensure we build everything by default
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2024-03-13 15:12:14 +00:00
Gustavo Romero and Alex Bennée
f84e313e02
gdbstub: Save target's siginfo
...
Save target's siginfo into gdbserver_state so it can be used later, for
example, in any stub that requires the target's si_signo and si_code.
This change affects only linux-user mode.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org >
Suggested-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20240309030901.1726211-4-gustavo.romero@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
2024-03-13 11:43:52 +00:00
Gustavo Romero and Alex Bennée
4d6d8a05a0
linux-user: Move tswap_siginfo out of target code
...
Move tswap_siginfo from target code to handle_pending_signal. This will
allow some cleanups and having the siginfo ready to be used in gdbstub.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org >
Suggested-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20240309030901.1726211-3-gustavo.romero@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
2024-03-13 11:43:52 +00:00
Gustavo Romero and Alex Bennée
b6617e937e
gdbstub: Rename back gdb_handlesig
...
Rename gdb_handlesig_reason back to gdb_handlesig. There is no need to
add a wrapper for gdb_handlesig and rename it when a new parameter is
added.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org >
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20240309030901.1726211-2-gustavo.romero@linaro.org >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
2024-03-13 11:43:52 +00:00
Peter Maydell
a1932d7cd6
Merge tag 'pull-tcg-20240312' of https://gitlab.com/rth7680/qemu into staging
...
linux-user: Add FIFREEZE and FITHAW ioctls
linux-user: Implement PR_*_{CHILD_SUBREAPER,SPECULATION_CTRL,TID_ADDRESS}
linux-user/elfload: Fixes for two Coverity CIDs
tcg/aarch64: Fixes for two TCG_COND_TST{EQ,NE} bugs
# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmXwoYwdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV99KwgAlUxbn0dPTXKmCkIE
# X+FAUllPYCZJwpTCa1h3P8taczLLeAocI4/iJxUudBE77I0HY7jv4FRnWrrdHr/V
# rQXjNkpQUByWr0Y4MB6Gl1+AKYo2SNqVHNP5AI4DdgDeSASXhP1aSlT5h4V4gdeX
# 1OwSnTQfONInJaoOQ7QQRf3JShKSYZSO7/sjMlJrubgGJBP8ivPxyPKiGbX3zUBS
# 6fI/ICLewC/g1fLPKaMHmqdrPK30ubPSGtnKdcz0q5NsT3hy6QWgtrQs5WAf3Liz
# 9WKGbq/y+qaFyLHat2tBpDnzT1Jso1SlIMkxL8kau3g6Pvk91E/pZjF5K3JOG8By
# PR4uQA==
# =FckT
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 12 Mar 2024 18:40:12 GMT
# gpg: using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg: issuer "richard.henderson@linaro.org "
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org >" [full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A 05C0 64DF 38E8 AF7E 215F
* tag 'pull-tcg-20240312' of https://gitlab.com/rth7680/qemu :
tcg/aarch64: Fix tcg_out_brcond for test comparisons
tcg/aarch64: Fix tcg_out_cmp for test comparisons
linux-user/elfload: Fully initialize struct target_elf_prpsinfo
linux-user/elfload: Don't close an unopened file descriptor
linux-user: Implement PR_GET_TID_ADDRESS
linux-user: Implement PR_{GET,SET}_SPECULATION_CTRL
linux-user: Implement PR_{GET,SET}_CHILD_SUBREAPER
linux-user: Add FIFREEZE and FITHAW ioctls
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2024-03-12 21:33:16 +00:00
Richard Henderson
52e566b34f
linux-user/elfload: Fully initialize struct target_elf_prpsinfo
...
Fixes Coverity CID: 1534962
Fixes: 243c470662 ("linux-user/elfload: Write corefile elf header in one block")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-03-12 03:36:24 -10:00
Richard Henderson
b35348c7e6
linux-user/elfload: Don't close an unopened file descriptor
...
Fixes Coverity CID: 1534964
Fixes: 106f8da664 ("linux-user/elfload: Open core file after vma_init")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-03-12 03:36:19 -10:00
Richard Henderson
8de24b1563
linux-user: Implement PR_GET_TID_ADDRESS
...
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-03-12 03:35:01 -10:00
Richard Henderson
91511bd40f
linux-user: Implement PR_{GET,SET}_SPECULATION_CTRL
...
Both of these only pass and return integral values.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-03-12 03:35:01 -10:00
Richard Henderson
07726f522d
linux-user: Implement PR_{GET,SET}_CHILD_SUBREAPER
...
The "set" prctl passes through integral values.
The "get" prctl returns the value into a pointer.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1929
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-03-12 03:35:00 -10:00
Michael Vogt and Richard Henderson
f9eebe31a7
linux-user: Add FIFREEZE and FITHAW ioctls
...
Add missing FIFREEZE and FITHAW ioctls.
Signed-off-by: Michael Vogt <michael.vogt@gmail.com >
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com >
Message-Id: <20240220105726.8852-1-michael.vogt@gmail.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2024-03-12 03:35:00 -10:00
Philippe Mathieu-Daudé and Thomas Huth
42e62aadfd
user: Prefer fast cpu_env() over slower CPU QOM cast macro
...
Mechanical patch produced running the command documented
in scripts/coccinelle/cpu_env.cocci_template header.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Warner Losh <imp@bsdimp.com >
Message-ID: <20240129164514.73104-30-philmd@linaro.org >
Signed-off-by: Thomas Huth <thuth@redhat.com >
2024-03-12 12:04:25 +01:00
Philippe Mathieu-Daudé and Thomas Huth
94956d7b51
bulk: Call in place single use cpu_env()
...
Avoid CPUArchState local variable when cpu_env() is used once.
Mechanical patch using the following Coccinelle spatch script:
@@
type CPUArchState;
identifier env;
expression cs;
@@
{
- CPUArchState *env = cpu_env(cs);
... when != env
- env
+ cpu_env(cs)
... when != env
}
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-ID: <20240129164514.73104-5-philmd@linaro.org >
Signed-off-by: Thomas Huth <thuth@redhat.com >
2024-03-12 11:46:16 +01:00
Christoph Müllner and Alistair Francis
4f1a53b362
linux-user/riscv: Add Ztso extension to hwprobe
...
This patch exposes Ztso via hwprobe in QEMU's user space emulator.
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu >
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-ID: <20240207122256.902627-3-christoph.muellner@vrull.eu >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2024-03-08 20:48:03 +10:00
Christoph Müllner and Alistair Francis
a3432cf227
linux-user/riscv: Sync hwprobe keys with Linux
...
Upstream Linux recently added many additional keys to the hwprobe API.
This patch adds support for all of them with the exception of Ztso,
which is currently not supported in QEMU.
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu >
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-ID: <20240207115926.887816-3-christoph.muellner@vrull.eu >
[ Changes by AF:
- Fixup whitespace
]
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2024-03-08 16:26:52 +10:00
Christoph Müllner and Alistair Francis
0191131dba
linux-user/riscv: Add Zicboz extensions to hwprobe
...
Upstream Linux recently added RISC-V Zicboz support to the hwprobe API.
This patch introduces this for QEMU's user space emulator.
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu >
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-ID: <20240207115926.887816-2-christoph.muellner@vrull.eu >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2024-03-08 15:42:49 +10:00
Ilya Leoshkevich and Alex Bennée
6604b05763
gdbstub: Call gdbserver_fork() both in parent and in child
...
The upcoming follow-fork-mode child support requires post-fork message
exchange between the parent and the child. Prepare gdbserver_fork() for
this purpose. Rename it to gdbserver_fork_end() to better reflect its
purpose.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Message-Id: <20240219141628.246823-8-iii@linux.ibm.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-9-alex.bennee@linaro.org >
2024-03-06 12:35:19 +00:00
Ilya Leoshkevich and Alex Bennée
9d456e092d
{linux,bsd}-user: Pass pid to gdbserver_fork()
...
The upcoming follow-fork-mode child support requires knowing the child
pid. Pass it down.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Message-Id: <20240219141628.246823-7-iii@linux.ibm.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-8-alex.bennee@linaro.org >
2024-03-06 12:35:19 +00:00
Ilya Leoshkevich and Alex Bennée
4edc98fcc8
{linux,bsd}-user: Pass pid to fork_end()
...
The upcoming follow-fork-mode child support requires knowing the child
pid. Pass it down.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Message-Id: <20240219141628.246823-6-iii@linux.ibm.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-7-alex.bennee@linaro.org >
2024-03-06 12:35:19 +00:00
Ilya Leoshkevich and Alex Bennée
3d6ed98da8
gdbstub: Introduce gdbserver_fork_start()
...
The upcoming follow-fork-mode child support requires knowing when
fork() is about to happen in order to initialize its state. Add a hook
for that.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com >
Message-Id: <20240219141628.246823-5-iii@linux.ibm.com >
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20240305121005.3528075-6-alex.bennee@linaro.org >
2024-03-06 12:35:19 +00:00