d713cf4d | 11-Jul-2023 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
linux-user/arm: Do not allocate a commpage at all for M-profile CPUs
Since commit fbd3c4cff6 ("linux-user/arm: Mark the commpage executable") executing bare-metal (linked with rdimon.specs) cortex-M
linux-user/arm: Do not allocate a commpage at all for M-profile CPUs
Since commit fbd3c4cff6 ("linux-user/arm: Mark the commpage executable") executing bare-metal (linked with rdimon.specs) cortex-M code fails as:
$ qemu-arm -cpu cortex-m3 ~/hello.exe.m3 qemu-arm: ../../accel/tcg/user-exec.c:492: page_set_flags: Assertion `last <= GUEST_ADDR_MAX' failed. Aborted (core dumped)
Commit 4f5c67f8df ("linux-user/arm: Take more care allocating commpage") already took care of not allocating a commpage for M-profile CPUs, however it had to be reverted as commit 6cda41daa2.
Re-introduce the M-profile fix from commit 4f5c67f8df.
Fixes: fbd3c4cff6 ("linux-user/arm: Mark the commpage executable") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1755 Reported-by: Christophe Lyon <christophe.lyon@linaro.org> Suggested-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Anton Johansson <anjo@rev.ng> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230711153408.68389-1-philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
ac42f443 | 09-Jul-2023 |
Juan Quintela <quintela@redhat.com> |
linux-user: Drop uint and ulong
These are types not used anymore anywhere else.
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Revi
linux-user: Drop uint and ulong
These are types not used anymore anywhere else.
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: <20230511085056.13809-1-quintela@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
e230ec09 | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Simplify target_madvise
The trivial length 0 check can be moved up, simplifying some of the other cases. The end < start test is handled by guest_range_valid_untagged.
Signed-off-by: R
linux-user: Simplify target_madvise
The trivial length 0 check can be moved up, simplifying some of the other cases. The end < start test is handled by guest_range_valid_untagged.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-27-richard.henderson@linaro.org>
show more ...
|
ecb796db | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Remove can_passthrough_madvise
Use page_check_range instead, which uses the interval tree instead of checking each page individually.
Signed-off-by: Richard Henderson <richard.henderson
linux-user: Remove can_passthrough_madvise
Use page_check_range instead, which uses the interval tree instead of checking each page individually.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-26-richard.henderson@linaro.org>
show more ...
|
bef6f008 | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
accel/tcg: Return bool from page_check_range
Replace the 0/-1 result with true/false. Invert the sense of the test of all callers. Document the function.
Signed-off-by: Richard Henderson <richard.h
accel/tcg: Return bool from page_check_range
Replace the 0/-1 result with true/false. Invert the sense of the test of all callers. Document the function.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-25-richard.henderson@linaro.org>
show more ...
|
d7b0c5d0 | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Simplify target_munmap
All of the guest to host page adjustment is handled by mmap_reserve_or_unmap; there is no need to duplicate that. There are no failure modes for munmap after align
linux-user: Simplify target_munmap
All of the guest to host page adjustment is handled by mmap_reserve_or_unmap; there is no need to duplicate that. There are no failure modes for munmap after alignment and guest address range have been validated.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-23-richard.henderson@linaro.org>
show more ...
|
558a4411 | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Rename mmap_reserve to mmap_reserve_or_unmap
If !reserved_va, munmap instead and assert success. Update all callers.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Mess
linux-user: Rename mmap_reserve to mmap_reserve_or_unmap
If !reserved_va, munmap instead and assert success. Update all callers.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-22-richard.henderson@linaro.org>
show more ...
|
260561d8 | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Rewrite mmap_reserve
Use 'last' variables instead of 'end' variables; be careful about avoiding overflow. Assert that the mmap succeeded.
Signed-off-by: Richard Henderson <richard.hend
linux-user: Rewrite mmap_reserve
Use 'last' variables instead of 'end' variables; be careful about avoiding overflow. Assert that the mmap succeeded.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-21-richard.henderson@linaro.org>
show more ...
|
f9cd8f5e | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Use 'last' instead of 'end' in target_mmap
Complete the transition within the mmap functions to a formulation that does not overflow at the end of the address space.
Signed-off-by: Rich
linux-user: Use 'last' instead of 'end' in target_mmap
Complete the transition within the mmap functions to a formulation that does not overflow at the end of the address space.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230707204054.8792-20-richard.henderson@linaro.org>
show more ...
|
4c13048e | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Use page_find_range_empty for mmap_find_vma_reserved
Use the interval tree to find empty space, rather than probing each page in turn.
Signed-off-by: Richard Henderson <richard.henderso
linux-user: Use page_find_range_empty for mmap_find_vma_reserved
Use the interval tree to find empty space, rather than probing each page in turn.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-19-richard.henderson@linaro.org>
show more ...
|
99982beb | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Rewrite mmap_frag
Use 'last' variables instead of 'end' variables. Always zero MAP_ANONYMOUS fragments, which we previously failed to do if they were not writable; early exit in case we
linux-user: Rewrite mmap_frag
Use 'last' variables instead of 'end' variables. Always zero MAP_ANONYMOUS fragments, which we previously failed to do if they were not writable; early exit in case we allocate a new page from the kernel, known zeros.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-16-richard.henderson@linaro.org>
show more ...
|
7bdc1acc | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Rewrite target_mprotect
Use 'last' variables instead of 'end' variables. When host page size > guest page size, detect when adjacent host pages have the same protection and merge that ex
linux-user: Rewrite target_mprotect
Use 'last' variables instead of 'end' variables. When host page size > guest page size, detect when adjacent host pages have the same protection and merge that expanded host range into fewer syscalls.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-15-richard.henderson@linaro.org>
show more ...
|
55baec0f | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Widen target_mmap offset argument to off_t
We build with _FILE_OFFSET_BITS=64, so off_t = off64_t = uint64_t. With an extra cast, this fixes emulation of mmap2, which could overflow the
linux-user: Widen target_mmap offset argument to off_t
We build with _FILE_OFFSET_BITS=64, so off_t = off64_t = uint64_t. With an extra cast, this fixes emulation of mmap2, which could overflow the computation of the full value of offset.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-14-richard.henderson@linaro.org>
show more ...
|
0dd55812 | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Split out target_to_host_prot
Split out from validate_prot_to_pageflags, as there is not one single host_prot for the entire range. We need to adjust prot for every host page that overl
linux-user: Split out target_to_host_prot
Split out from validate_prot_to_pageflags, as there is not one single host_prot for the entire range. We need to adjust prot for every host page that overlaps multiple guest pages.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-13-richard.henderson@linaro.org>
show more ...
|
03798605 | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Implement MAP_FIXED_NOREPLACE
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-12-richard.henderson@linaro.org> |
4b840f96 | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Populate more bits in mmap_flags_tbl
Fix translation of TARGET_MAP_SHARED and TARGET_MAP_PRIVATE, which are types not single bits. Add TARGET_MAP_SHARED_VALIDATE, TARGET_MAP_SYNC, TARGE
linux-user: Populate more bits in mmap_flags_tbl
Fix translation of TARGET_MAP_SHARED and TARGET_MAP_PRIVATE, which are types not single bits. Add TARGET_MAP_SHARED_VALIDATE, TARGET_MAP_SYNC, TARGET_MAP_NONBLOCK, TARGET_MAP_POPULATE, TARGET_MAP_FIXED_NOREPLACE, and TARGET_MAP_UNINITIALIZED.
Update strace to match.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-9-richard.henderson@linaro.org>
show more ...
|
6edfca9e | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Split TARGET_PROT_* out of syscall_defs.h
Move the values into the per-target target_mman.h headers
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé
linux-user: Split TARGET_PROT_* out of syscall_defs.h
Move the values into the per-target target_mman.h headers
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-8-richard.henderson@linaro.org>
show more ...
|
492fe4e7 | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Split TARGET_MAP_* out of syscall_defs.h
Move the values into the per-target target_mman.h headers
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <ri
linux-user: Split TARGET_MAP_* out of syscall_defs.h
Move the values into the per-target target_mman.h headers
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-7-richard.henderson@linaro.org>
show more ...
|
40965ad9 | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user/strace: Expand struct flags to hold a mask
A zero bit value does not make sense -- it must relate to some field in some way.
Define FLAG_BASIC with a build-time sanity check. Adjust FLAG
linux-user/strace: Expand struct flags to hold a mask
A zero bit value does not make sense -- it must relate to some field in some way.
Define FLAG_BASIC with a build-time sanity check. Adjust FLAG_GENERIC and FLAG_TARGET to use it. Add FLAG_GENERIC_MASK and FLAG_TARGET_MASK.
Fix up the existing flag definitions for build errors.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-6-richard.henderson@linaro.org>
show more ...
|
2b730f79 | 07-Jul-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Fix formatting of mmap.c
Fix all checkpatch.pl errors within mmap.c.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off
linux-user: Fix formatting of mmap.c
Fix all checkpatch.pl errors within mmap.c.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230707204054.8792-5-richard.henderson@linaro.org>
show more ...
|
d28b3c90 | 06-Jul-2023 |
Andreas Schwab <schwab@suse.de> |
linux-user: Make sure initial brk(0) is page-aligned
Fixes: 86f04735ac ("linux-user: Fix brk() to release pages") Signed-off-by: Andreas Schwab <schwab@suse.de> Message-Id: <mvmpm55qnno.fsf@suse.de>
linux-user: Make sure initial brk(0) is page-aligned
Fixes: 86f04735ac ("linux-user: Fix brk() to release pages") Signed-off-by: Andreas Schwab <schwab@suse.de> Message-Id: <mvmpm55qnno.fsf@suse.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
9b61f77f | 26-Jun-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Fix do_shmat type errors
The guest address, raddr, should be unsigned, aka abi_ulong. The host addresses should be cast via *intptr_t not long. Drop the inline and fix two other whitespa
linux-user: Fix do_shmat type errors
The guest address, raddr, should be unsigned, aka abi_ulong. The host addresses should be cast via *intptr_t not long. Drop the inline and fix two other whitespace issues.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Anton Johansson <anjo@rev.ng> Message-Id: <20230626140250.69572-1-richard.henderson@linaro.org>
show more ...
|
7a8d9f3a | 05-Jul-2023 |
Pierrick Bouvier <pierrick.bouvier@linaro.org> |
linux-user/syscall: Implement execve without execveat
Support for execveat syscall was implemented in 55bbe4 and is available since QEMU 8.0.0. It relies on host execveat, which is widely available
linux-user/syscall: Implement execve without execveat
Support for execveat syscall was implemented in 55bbe4 and is available since QEMU 8.0.0. It relies on host execveat, which is widely available on most of Linux kernels today.
However, this change breaks qemu-user self emulation, if "host" qemu version is less than 8.0.0. Indeed, it does not implement yet execveat. This strange use case happens with most of distribution today having binfmt support.
With a concrete failing example: $ qemu-x86_64-7.2 qemu-x86_64-8.0 /bin/bash -c /bin/ls /bin/bash: line 1: /bin/ls: Function not implemented -> not implemented means execve returned ENOSYS
qemu-user-static 7.2 and 8.0 can be conveniently grabbed from debian packages qemu-user-static* [1].
One usage of this is running wine-arm64 from linux-x64 (details [2]). This is by updating qemu embedded in docker image that we ran into this issue.
The solution to update host qemu is not always possible. Either it's complicated or ask you to recompile it, or simply is not accessible (GitLab CI, GitHub Actions). Thus, it could be worth to implement execve without relying on execveat, which is the goal of this patch.
This patch was tested with example presented in this commit message.
[1] http://ftp.us.debian.org/debian/pool/main/q/qemu/ [1] https://www.linaro.org/blog/emulate-windows-on-arm/
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru> Message-Id: <20230705121023.973284-1-pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
0f41be8d | 03-Jun-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Use abi_uint not unsigned in syscall_defs.h
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
20d49567 | 03-Jun-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Use abi_short not short in syscall_defs.h
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |