5b1270ef | 16-Sep-2023 |
Mikulas Patocka <mpatocka@redhat.com> |
linux-user/hppa: lock both words of function descriptor
The code in setup_rt_frame reads two words at haddr, but locks only one. This patch fixes it to lock both.
Signed-off-by: Mikulas Patocka <mp
linux-user/hppa: lock both words of function descriptor
The code in setup_rt_frame reads two words at haddr, but locks only one. This patch fixes it to lock both.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Acked-by: Helge Deller <deller@gmx.de> Cc: qemu-stable@nongnu.org Signed-off-by: Helge Deller <deller@gmx.de>
show more ...
|
2529497c | 16-Sep-2023 |
Mikulas Patocka <mpatocka@redhat.com> |
linux-user/hppa: clear the PSW 'N' bit when delivering signals
qemu-hppa may crash when delivering a signal. It can be demonstrated with this program. Compile the program with "hppa-linux-gnu-gcc -O
linux-user/hppa: clear the PSW 'N' bit when delivering signals
qemu-hppa may crash when delivering a signal. It can be demonstrated with this program. Compile the program with "hppa-linux-gnu-gcc -O2 signal.c" and run it with "qemu-hppa -one-insn-per-tb a.out". It reports that the address of the flag is 0xb4 and it crashes when attempting to touch it.
#include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <signal.h>
sig_atomic_t flag;
void sig(int n) { printf("&flag: %p\n", &flag); flag = 1; }
int main(void) { struct sigaction sa; struct itimerval it;
sa.sa_handler = sig; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESTART; if (sigaction(SIGALRM, &sa, NULL)) perror("sigaction"), exit(1);
it.it_interval.tv_sec = 0; it.it_interval.tv_usec = 100; it.it_value.tv_sec = it.it_interval.tv_sec; it.it_value.tv_usec = it.it_interval.tv_usec;
if (setitimer(ITIMER_REAL, &it, NULL)) perror("setitimer"), exit(1);
while (1) { } }
The reason for the crash is that the signal handling routine doesn't clear the 'N' flag in the PSW. If the signal interrupts a thread when the 'N' flag is set, the flag remains set at the beginning of the signal handler and the first instruction of the signal handler is skipped.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Acked-by: Helge Deller <deller@gmx.de> Cc: qemu-stable@nongnu.org Signed-off-by: Helge Deller <deller@gmx.de>
show more ...
|
bb0a45e9 | 28-Aug-2023 |
Robbin Ehn <rehn@rivosinc.com> |
linux-user/riscv: Add new extensions to hwprobe
This patch adds the new extensions in linux 6.5 to the hwprobe syscall.
And fixes RVC check to OR with correct value. The previous variable contains
linux-user/riscv: Add new extensions to hwprobe
This patch adds the new extensions in linux 6.5 to the hwprobe syscall.
And fixes RVC check to OR with correct value. The previous variable contains 0 therefore it did work.
Signed-off-by: Robbin Ehn <rehn@rivosinc.com> Acked-by: Richard Henderson <richard.henderson@linaro.org> Acked-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <bc82203b72d7efb30f1b4a8f9eb3d94699799dc8.camel@rivosinc.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
show more ...
|
ae7d4d62 | 11-Aug-2023 |
LIU Zhiwei <zhiwei_liu@linux.alibaba.com> |
linux-user/riscv: Use abi type for target_ucontext
We should not use types dependend on host arch for target_ucontext. This bug is found when run rv32 applications.
Signed-off-by: LIU Zhiwei <zhiwe
linux-user/riscv: Use abi type for target_ucontext
We should not use types dependend on host arch for target_ucontext. This bug is found when run rv32 applications.
Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20230811055438.1945-1-zhiwei_liu@linux.alibaba.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
show more ...
|
044e95c8 | 20-Aug-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Track shm regions with an interval tree
Remove the fixed size shm_regions[] array. Remove references when other mappings completely remove or replace a region.
Tested-by: Helge Deller <
linux-user: Track shm regions with an interval tree
Remove the fixed size shm_regions[] array. Remove references when other mappings completely remove or replace a region.
Tested-by: Helge Deller <deller@gmx.de> Reviewed-by: Helge Deller <deller@gmx.de> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
ceda5688 | 20-Aug-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Fix shmdt
If the shm region is not mapped at shmaddr, EINVAL. Do not unmap the region until the syscall succeeds. Use mmap_reserve_or_unmap to preserve reserved_va semantics.
Tested-by:
linux-user: Fix shmdt
If the shm region is not mapped at shmaddr, EINVAL. Do not unmap the region until the syscall succeeds. Use mmap_reserve_or_unmap to preserve reserved_va semantics.
Tested-by: Helge Deller <deller@gmx.de> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
69fa2708 | 20-Aug-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Use WITH_MMAP_LOCK_GUARD in target_{shmat,shmdt}
Move the CF_PARALLEL setting outside of the mmap lock.
Tested-by: Helge Deller <deller@gmx.de> Reviewed-by: Helge Deller <deller@gmx.de>
linux-user: Use WITH_MMAP_LOCK_GUARD in target_{shmat,shmdt}
Move the CF_PARALLEL setting outside of the mmap lock.
Tested-by: Helge Deller <deller@gmx.de> Reviewed-by: Helge Deller <deller@gmx.de> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
225a206c | 20-Aug-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Move shmat and shmdt implementations to mmap.c
Rename from do_* to target_*. Fix some minor checkpatch errors.
Tested-by: Helge Deller <deller@gmx.de> Tested-by: Philippe Mathieu-Daudé
linux-user: Move shmat and shmdt implementations to mmap.c
Rename from do_* to target_*. Fix some minor checkpatch errors.
Tested-by: Helge Deller <deller@gmx.de> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Warner Losh <imp@bsdimp.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
f6d45542 | 16-Aug-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Remove ELF_START_MMAP and image_info.start_mmap
The start_mmap value is write-only. Remove the field and the defines that populated it. Logically, this has been replaced by task_unmapped
linux-user: Remove ELF_START_MMAP and image_info.start_mmap
The start_mmap value is write-only. Remove the field and the defines that populated it. Logically, this has been replaced by task_unmapped_base.
Tested-by: Helge Deller <deller@gmx.de> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
6467d9eb | 24-Aug-2023 |
Ilya Leoshkevich <iii@linux.ibm.com> |
linux-user: Emulate the Anonymous: keyword in /proc/self/smaps
Core dumps produced by gdb's gcore when connected to qemu's gdbstub lack stack. The reason is that gdb includes only anonymous memory i
linux-user: Emulate the Anonymous: keyword in /proc/self/smaps
Core dumps produced by gdb's gcore when connected to qemu's gdbstub lack stack. The reason is that gdb includes only anonymous memory in core dumps, which is distinguished by a non-0 Anonymous: value.
Consider the mappings with PAGE_ANON fully anonymous, and the mappings without it fully non-anonymous.
Tested-by: Helge Deller <deller@gmx.de> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> [rth: Update for open_self_maps_* rewrite] Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
92d2a03f | 16-Aug-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Show heap address in /proc/pid/maps
Tested-by: Helge Deller <deller@gmx.de> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Sign
linux-user: Show heap address in /proc/pid/maps
Tested-by: Helge Deller <deller@gmx.de> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
aec338d6 | 16-Aug-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Adjust brk for load_bias
PIE executables are usually linked at offset 0 and are relocated somewhere during load. The hiaddr needs to be adjusted to keep the brk next to the executable.
linux-user: Adjust brk for load_bias
PIE executables are usually linked at offset 0 and are relocated somewhere during load. The hiaddr needs to be adjusted to keep the brk next to the executable.
Cc: qemu-stable@nongnu.org Fixes: 1f356e8c013 ("linux-user: Adjust initial brk when interpreter is close to executable") Tested-by: Helge Deller <deller@gmx.de> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
7b7a3366 | 09-Aug-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Use walk_memory_regions for open_self_maps
Replace the by-hand method of region identification with the official user-exec interface. Cross-check the region provided to the callback wit
linux-user: Use walk_memory_regions for open_self_maps
Replace the by-hand method of region identification with the official user-exec interface. Cross-check the region provided to the callback with the interval tree from read_self_maps().
Tested-by: Helge Deller <deller@gmx.de> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
79be812b | 09-Aug-2023 |
Richard Henderson <richard.henderson@linaro.org> |
util/selfmap: Use dev_t and ino_t in MapInfo
Use dev_t instead of a string, and ino_t instead of uint64_t. The latter is likely to be identical on modern systems but is more type-correct for usage.
util/selfmap: Use dev_t and ino_t in MapInfo
Use dev_t instead of a string, and ino_t instead of uint64_t. The latter is likely to be identical on modern systems but is more type-correct for usage.
Tested-by: Helge Deller <deller@gmx.de> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
4757e2c7 | 03-Aug-2023 |
Helge Deller <deller@gmx.de> |
linux-user: Emulate /proc/cpuinfo for Alpha
Add emulation for /proc/cpuinfo for the alpha architecture.
alpha output example:
(alpha-chroot)root@p100:/# cat /proc/cpuinfo cpu :
linux-user: Emulate /proc/cpuinfo for Alpha
Add emulation for /proc/cpuinfo for the alpha architecture.
alpha output example:
(alpha-chroot)root@p100:/# cat /proc/cpuinfo cpu : Alpha cpu model : ev67 cpu variation : 0 cpu revision : 0 cpu serial number : JA00000000 system type : QEMU system variation : QEMU_v8.0.92 system revision : 0 system serial number : AY00000000 cycle frequency [Hz] : 250000000 timer frequency [Hz] : 250.00 page size [bytes] : 8192 phys. address bits : 44 max. addr. space # : 255 BogoMIPS : 2500.00 platform string : AlphaServer QEMU user-mode VM cpus detected : 8 cpus active : 4 cpu active mask : 0000000000000095 L1 Icache : n/a L1 Dcache : n/a L2 cache : n/a L3 cache : n/a
Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230803214450.647040-4-deller@gmx.de> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
a55b9e72 | 03-Aug-2023 |
Helge Deller <deller@gmx.de> |
linux-user: Emulate /proc/cpuinfo on aarch64 and arm
Add emulation for /proc/cpuinfo for arm architecture. The output below mimics output as seen on debian porterboxes.
aarch64 output example:
pro
linux-user: Emulate /proc/cpuinfo on aarch64 and arm
Add emulation for /proc/cpuinfo for arm architecture. The output below mimics output as seen on debian porterboxes.
aarch64 output example:
processor : 0 model name : ARMv8 Processor rev 0 (v8l) BogoMIPS : 100.00 Features : swp half thumb fast_mult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae aes pmull sha1 sha2 crc32 CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x1 CPU part : 0xd07 CPU revision : 0
arm 32-bit output example:
processor : 0 model name : ARMv7 Processor rev 5 (armv7l) BogoMIPS : 100.00 Features : swp half thumb fast_mult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0f CPU part : 0xc07 CPU revision : 5
Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230803214450.647040-3-deller@gmx.de> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
121c8dd6 | 24-Aug-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Split out cpu/target_proc.h
Move the various open_cpuinfo functions into new files. Move the m68k open_hardware function as well. All other guest architectures get a boilerplate empty fi
linux-user: Split out cpu/target_proc.h
Move the various open_cpuinfo functions into new files. Move the m68k open_hardware function as well. All other guest architectures get a boilerplate empty file.
Tested-by: Helge Deller <deller@gmx.de> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
669dcb60 | 23-Aug-2023 |
Michael Tokarev <mjt@tls.msk.ru> |
accel/tcg: spelling fixes
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20230823065335.1919380-18-mjt@tls.msk.ru> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-ID: <202308
accel/tcg: spelling fixes
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Message-ID: <20230823065335.1919380-18-mjt@tls.msk.ru> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-ID: <20230823065335.1919380-19-mjt@tls.msk.ru> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
show more ...
|
ffc8453b | 04-Aug-2023 |
Ilya Leoshkevich <iii@linux.ibm.com> |
linux-user/elfload: Enable vxe2 on s390x
The vxe2 hwcap is not set for programs running in linux-user, but is set by a Linux kernel running in softmmu. Add it to the former.
Signed-off-by: Ilya Leo
linux-user/elfload: Enable vxe2 on s390x
The vxe2 hwcap is not set for programs running in linux-user, but is set by a Linux kernel running in softmmu. Add it to the former.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20230804233748.218935-2-iii@linux.ibm.com> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Claudio Fontana <cfontana@suse.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
show more ...
|
b8002058 | 03-Aug-2023 |
Helge Deller <deller@gmx.de> |
linux-user: Fix openat() emulation to correctly detect accesses to /proc
In qemu we catch accesses to files like /proc/cpuinfo or /proc/net/route and return to the guest contents which would be visi
linux-user: Fix openat() emulation to correctly detect accesses to /proc
In qemu we catch accesses to files like /proc/cpuinfo or /proc/net/route and return to the guest contents which would be visible on a real system (instead what the host would show).
This patch fixes a bug, where for example the accesses cat /proc////cpuinfo or cd /proc && cat cpuinfo will not be recognized by qemu and where qemu will wrongly show the contents of the host's /proc/cpuinfo file.
Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230803214450.647040-2-deller@gmx.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
a05cee93 | 08-Aug-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Use ARRAY_SIZE with bitmask_transtbl
Rather than using a zero tuple to end the table, use a macro to apply ARRAY_SIZE and pass that on to the convert functions.
This fixes two bugs in w
linux-user: Use ARRAY_SIZE with bitmask_transtbl
Rather than using a zero tuple to end the table, use a macro to apply ARRAY_SIZE and pass that on to the convert functions.
This fixes two bugs in which the conversion functions required that both the target and host masks be non-zero in order to continue, rather than require both target and host masks be zero in order to terminate.
This affected mmap_flags_tbl when the host does not support all of the flags we wish to convert (e.g. MAP_UNINITIALIZED). Mapping these flags to zero is good enough, and matches how the kernel ignores bits that are unknown.
Fixes: 4b840f96 ("linux-user: Populate more bits in mmap_flags_tbl") Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
9ab8d071 | 08-Aug-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Split out do_mmap
New function that rejects unsupported map types and flags. In 4b840f96 we should not have accepted MAP_SHARED_VALIDATE without actually validating the rest of the flags
linux-user: Split out do_mmap
New function that rejects unsupported map types and flags. In 4b840f96 we should not have accepted MAP_SHARED_VALIDATE without actually validating the rest of the flags.
Fixes: 4b840f96 ("linux-user: Populate more bits in mmap_flags_tbl") Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
dd558855 | 07-Aug-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Rewrite non-fixed probe_guest_base
Use pgb_addr_set to probe for all of the guest addresses, not just the main executable. Handle the identity map specially and separately from the sear
linux-user: Rewrite non-fixed probe_guest_base
Use pgb_addr_set to probe for all of the guest addresses, not just the main executable. Handle the identity map specially and separately from the search.
If /proc/self/maps is available, utilize the full power of the interval tree search, rather than a linear search through the address list.
If /proc/self/maps is not available, increase the skip between probes so that we do not probe every single page of the host address space. Choose 1 MiB for 32-bit hosts (max 4k probes) and 1 GiB for 64-bit hosts (possibly a large number of probes, but the large step makes it more likely to find empty space quicker).
Tested-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
06f38c66 | 07-Aug-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Rewrite fixed probe_guest_base
Create a set of subroutines to collect a set of guest addresses, all of which must be mappable on the host. Use this within the renamed pgb_fixed subrouti
linux-user: Rewrite fixed probe_guest_base
Create a set of subroutines to collect a set of guest addresses, all of which must be mappable on the host. Use this within the renamed pgb_fixed subroutine to validate the user's choice of guest_base specified by the -B command-line option.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
0c441aeb | 07-Aug-2023 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Consolidate guest bounds check in probe_guest_base
The three sets of checks are identical, logically.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson
linux-user: Consolidate guest bounds check in probe_guest_base
The three sets of checks are identical, logically.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|