summary refs log tree commit diff stats
path: root/linux-user (follow)
Commit message (Collapse)AuthorAgeFilesLines
* linux-user: Add FIFREEZE and FITHAW ioctlsMichael Vogt2024-03-122-0/+9
| | | | | | | | | | 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>
* linux-user/riscv: Add Ztso extension to hwprobeChristoph Müllner2024-03-081-0/+3
| | | | | | | | | 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>
* linux-user/riscv: Sync hwprobe keys with LinuxChristoph Müllner2024-03-081-8/+92
| | | | | | | | | | | | | | 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>
* linux-user/riscv: Add Zicboz extensions to hwprobeChristoph Müllner2024-03-081-0/+3
| | | | | | | | | | 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>
* gdbstub: Call gdbserver_fork() both in parent and in childIlya Leoshkevich2024-03-061-1/+1
| | | | | | | | | | | | | 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>
* {linux,bsd}-user: Pass pid to gdbserver_fork()Ilya Leoshkevich2024-03-061-1/+1
| | | | | | | | | | | 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>
* {linux,bsd}-user: Pass pid to fork_end()Ilya Leoshkevich2024-03-063-5/+7
| | | | | | | | | | | | 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>
* gdbstub: Introduce gdbserver_fork_start()Ilya Leoshkevich2024-03-061-0/+1
| | | | | | | | | | | | 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>
* {linux,bsd}-user: Update ts_tid after fork()Ilya Leoshkevich2024-03-061-0/+1
| | | | | | | | | | | | | | Currently ts_tid contains the parent tid after fork(), which is not correct. So far it has not affected anything, but the upcoming follow-fork-mode child support relies on the correct value, so fix it. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Warner Losh <imp@bsdimp.com> Message-Id: <20240219141628.246823-4-iii@linux.ibm.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240305121005.3528075-5-alex.bennee@linaro.org>
* {linux,bsd}-user: Introduce get_task_state()Ilya Leoshkevich2024-03-0618-53/+58
| | | | | | | | | | | | | | A CPU's TaskState is stored in the CPUState's void *opaque field, accessing which is somewhat awkward due to having to use a cast. Introduce a wrapper and use it everywhere. Suggested-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20240219141628.246823-3-iii@linux.ibm.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240305121005.3528075-4-alex.bennee@linaro.org>
* linux-user: Rewrite target_shmatRichard Henderson2024-03-011-33/+133
| | | | | | | | | | Handle combined host and guest alignment requirements. Handle host and guest page size differences. Handle SHM_EXEC. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/115 Tested-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Add strace for shmatRichard Henderson2024-03-012-1/+25
| | | | | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user/loongarch64: Remove TARGET_FORCE_SHMLBARichard Henderson2024-02-291-7/+0
| | | | | | | | | | | | | | | The kernel abi was changed with commit d23b77953f5a4fbf94c05157b186aac2a247ae32 Author: Huacai Chen <chenhuacai@kernel.org> Date: Wed Jan 17 12:43:08 2024 +0800 LoongArch: Change SHMLBA from SZ_64K to PAGE_SIZE during the v6.8 cycle. Reviewed-by: Song Gao <gaosong@loongson.cn> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user/x86_64: Handle the vsyscall page in open_self_maps_{2,4}Richard Henderson2024-02-291-0/+16
| | | | | | | | | | This is the only case in which we expect to have no host memory backing for a guest memory page, because in general linux user processes cannot map any pages in the top half of the 64-bit address space. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2170 Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Remove pgb_dynamic alignment assertionRichard Henderson2024-02-291-2/+0
| | | | | | | | | | | | | | The assertion was never correct, because the alignment is a composite of the image alignment and SHMLBA. Even if the image alignment didn't match the image address, an assertion would not be correct -- more appropriate would be an error message about an ill formed image. But the image cannot be held to SHMLBA under any circumstances. Fixes: ee94743034b ("linux-user: completely re-write init_guest_space") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2157 Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reported-by: Alexey Sheplyakov <asheplyakov@yandex.ru> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
* linux-user: Bound mmap_min_addr by host page sizeRichard Henderson2024-02-291-1/+1
| | | | | | | | | | | Bizzarely, it is possible to set /proc/sys/vm/mmap_min_addr to a value below the host page size. Fix that. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-32-richard.henderson@linaro.org>
* linux-user: Allow TARGET_PAGE_BITS_VARYRichard Henderson2024-02-291-3/+13
| | | | | | | | | If set, match the host and guest page sizes. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-30-richard.henderson@linaro.org>
* *-user: Deprecate and disable -p pagesizeRichard Henderson2024-02-291-6/+6
| | | | | | | | | | | | | | | | This option controls the host page size. From the mis-usage in our own testsuite, this is easily confused with guest page size. The only thing that occurs when changing the host page size is that stuff breaks, because one cannot actually change the host page size. Therefore reject all but the no-op setting as part of the deprecation process. Reviewed-by: Warner Losh <imp@bsdimp.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-27-richard.henderson@linaro.org>
* linux-user: Split out mmap_h_gt_gRichard Henderson2024-02-291-149/+139
| | | | | | | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-24-richard.henderson@linaro.org>
* linux-user: Split out mmap_h_lt_gRichard Henderson2024-02-291-31/+153
| | | | | | | | | | | Work much harder to get alignment and mapping beyond the end of the file correct. Both of which are excercised by our test-mmap for alpha (8k pages) on any 4k page host. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-23-richard.henderson@linaro.org>
* linux-user: Split out mmap_h_eq_gRichard Henderson2024-02-291-13/+55
| | | | | | | | | | Move the MAX_FIXED_NOREPLACE check for reserved_va earlier. Move the computation of host_prot earlier. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-22-richard.henderson@linaro.org>
* linux-user: Use do_munmap for target_mmap failureRichard Henderson2024-02-291-3/+3
| | | | | | | | | For the cases for which the host mmap succeeds, but does not yield the desired address, use do_munmap to restore the reserved_va memory reservation. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Split out do_munmapRichard Henderson2024-02-291-7/+16
| | | | | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user: Do early mmap placement only for reserved_vaRichard Henderson2024-02-291-5/+7
| | | | | | | | | | | For reserved_va, place all non-fixed maps then proceed as for MAP_FIXED. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-21-richard.henderson@linaro.org>
* linux-user: Split out mmap_endRichard Henderson2024-02-291-30/+41
| | | | | | | | | | Use a subroutine instead of a goto within target_mmap__locked. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-20-richard.henderson@linaro.org>
* linux-user: Fix sub-host-page mmapRichard Henderson2024-02-291-3/+2
| | | | | | | | | | | | We cannot skip over the_end1 to the_end, because we fail to record the validity of the guest page with the interval tree. Remove "the_end" and rename "the_end1" to "the_end". Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-19-richard.henderson@linaro.org>
* linux-user: Move some mmap checks outside the lockRichard Henderson2024-02-291-54/+53
| | | | | | | | | | | Basic validation of operands does not require the lock. Hoist them from target_mmap__locked back into target_mmap. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-18-richard.henderson@linaro.org>
* linux-user: Split out target_mmap__lockedRichard Henderson2024-02-291-27/+35
| | | | | | | | | | | All "goto fail" may be transformed to "return -1". Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-17-richard.henderson@linaro.org>
* linux-user: Remove qemu_host_page_size from mainRichard Henderson2024-02-291-4/+6
| | | | | | | | | | Use qemu_real_host_page_size() instead. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-16-richard.henderson@linaro.org>
* linux-user: Remove HOST_PAGE_ALIGN from mmap.cRichard Henderson2024-02-291-7/+6
| | | | | | | | | | | This removes a hidden use of qemu_host_page_size, using instead the existing host_page_size local within each function. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-11-richard.henderson@linaro.org>
* linux-user: Remove REAL_HOST_PAGE_ALIGN from mmap.cRichard Henderson2024-02-291-1/+1
| | | | | | | | | | We already have qemu_real_host_page_size() in a local variable. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-10-richard.henderson@linaro.org>
* linux-user: Remove qemu_host_page_{size, mask} from mmap.cRichard Henderson2024-02-291-33/+33
| | | | | | | | | | Use qemu_real_host_page_size instead. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-9-richard.henderson@linaro.org>
* linux-user: Remove qemu_host_page_size from elf_core_dumpRichard Henderson2024-02-291-1/+1
| | | | | | Used only once in wmr_page_unprotect_regions. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user/arm: Remove qemu_host_page_size from init_guest_commpageRichard Henderson2024-02-291-5/+8
| | | | | | | | | | Use qemu_real_host_page_size. If the commpage is not within reserved_va, use MAP_FIXED_NOREPLACE. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-8-richard.henderson@linaro.org>
* linux-user/nios2: Remove qemu_host_page_size from init_guest_commpageRichard Henderson2024-02-291-6/+10
| | | | | | | | | | Use qemu_real_host_page_size. If !reserved_va, use MAP_FIXED_NOREPLACE. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-7-richard.henderson@linaro.org>
* linux-user/hppa: Simplify init_guest_commpageRichard Henderson2024-02-291-10/+14
| | | | | | | | | | | | If reserved_va, then we have already reserved the entire guest virtual address space; no need to remap page. If !reserved_va, then use MAP_FIXED_NOREPLACE. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-6-richard.henderson@linaro.org>
* linux-user: Remove qemu_host_page_size from create_elf_tablesRichard Henderson2024-02-291-7/+1
| | | | | | | | | | | | | | | AT_PAGESZ is supposed to advertise the guest page size. The random adjustment made here using qemu_host_page_size does not match anything else within linux-user. The idea here is good, but should be done more systemically via adjustment to TARGET_PAGE_SIZE. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-5-richard.henderson@linaro.org>
* linux-user: Remove qemu_host_page_{size, mask} in probe_guest_baseRichard Henderson2024-02-291-2/+2
| | | | | | | | | | | | The host SHMLBA is by definition a multiple of the host page size. Thus the remaining component of qemu_host_page_size is the target page size. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-4-richard.henderson@linaro.org>
* linux-user: Adjust SVr4 NULL page mappingRichard Henderson2024-02-291-2/+3
| | | | | | | | | | | | | | Use TARGET_PAGE_SIZE and MAP_FIXED_NOREPLACE. We really should be attending to this earlier during probe_guest_base, as well as better detection and emulation of various Linux personalities. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-3-richard.henderson@linaro.org>
* linux-user/elfload: Unprotect regions before core dumpRichard Henderson2024-02-291-0/+22
| | | | | | | | By unprotecting regions, we re-instate writability and unify regions that have been split, which may reduce the total number of regions. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user/elfload: Rely on walk_memory_regions for vmasRichard Henderson2024-02-291-135/+78
| | | | | | | | | | Rather than creating new data structures for vma, rely on the IntervalTree used by walk_memory_regions. Use PAGE_* constants, per the page table api, rather than PROT_* constants, per the mmap api. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user/elfload: Simplify vma_dump_sizeRichard Henderson2024-02-291-24/+10
| | | | | | | | Use the flags that we've already saved in order to test accessibility. Use g2h_untagged and compare guest memory directly instead of copy_from_user. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user/elfload: Write process memory to core file in larger chunksRichard Henderson2024-02-291-23/+4
| | | | | | | | We do not need to copy pages from guest memory before writing them out. Because vmas are contiguous in host memory, we can write them in one go. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user/elfload: Write corefile elf header in one blockRichard Henderson2024-02-291-300/+116
| | | | | | | | | | | | | Fixes a bug in which write_note() wrote namesz_rounded and datasz_rounded bytes, even though name and data pointers contain only the unrounded number of bytes. Instead of many small writes, allocate a block to contain all of the elf headers and all of the notes. Copy the data into the block piecemeal and the write it to the file as a chunk. This also avoids the need to lseek forward for alignment. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user/elfload: Size corefile before openingRichard Henderson2024-02-291-39/+44
| | | | | | | Verify the size of the corefile vs the rlimit before opening and creating the core file at all. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user/elfload: Lock cpu list and mmap during elf_core_dumpRichard Henderson2024-02-291-6/+9
| | | | | | | | Do not allow changes to the set of cpus and memory regions while we are dumping core. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user/elfload: Truncate core file on openRichard Henderson2024-02-291-1/+1
| | | | | | While we usually create a new corefile, truncate otherwise. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user/elfload: Open core file after vma_initRichard Henderson2024-02-291-7/+9
| | | | | | | | | Swap the ordering of vma_init and open. This will be necessary for further changes, and adjusts the error cleanup path. Narrow the scope of corefile, as the variable can be freed immediately after use in open(). Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user/elfload: Latch errno before cleanup in elf_core_dumpRichard Henderson2024-02-291-7/+5
| | | | | | | | | | On the off-chance that one of the cleanup functions changes errno, latch the errno that we want to return beforehand. Flush errno to 0 upon success, rather than at the beginning. No need to avoid negation of 0. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
* linux-user/elfload: Stack allocate struct mm_structRichard Henderson2024-02-291-19/+9
| | | | | | | Ignoring the fact that g_malloc cannot fail, the structure is quite small and might as well be allocated locally. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>