- Oct 04, 2022
-
-
Richard Henderson authored
The value previously chosen overlaps GUSA_MASK. Rename all DELAY_SLOT_* and GUSA_* defines to emphasize that they are included in TB_FLAGs. Add aliases for the FPSCR and SR bits that are included in TB_FLAGS, so that we don't accidentally reassign those bits. Fixes: 4da06fb3 ("target/sh4: Implement prctl_unalign_sigbus") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/856 Reviewed-by:
Yoshinori Sato <ysato@users.sourceforge.jp> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org>
-
- Sep 28, 2022
-
-
Helge Deller authored
Signed-off-by:
Helge Deller <deller@gmx.de> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20220927093538.8954-2-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Sep 27, 2022
-
-
Richard Henderson authored
Do not allow syscall arguments to be interleaved between threads. Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20220829021006.67305-8-richard.henderson@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Richard Henderson authored
Use a table for the names; print unknown values in hex, since the value contains flags. Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220829021006.67305-7-richard.henderson@linaro.org> [lv: update print_futex() according to "linux-user: Show timespec on strace for futex()"] Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Richard Henderson authored
Define the missing FUTEX_* constants in syscall_defs.h Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20220829021006.67305-6-richard.henderson@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Richard Henderson authored
The val argument to FUTEX_FD is a signal number. Convert to match the host, as it will be converted back when the signal is delivered. Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20220829021006.67305-5-richard.henderson@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Richard Henderson authored
Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20220829021006.67305-4-richard.henderson@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Richard Henderson authored
Leave only the argument adjustments within the shift, and sink the actual syscall to the end. Sink the timespec conversion as well, as there will be more users. Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20220829021006.67305-3-richard.henderson@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Richard Henderson authored
Pass a boolean to select between time32 and time64. Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20220829021006.67305-2-richard.henderson@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Jiaxun Yang authored
Match most appropriate base platform string based on insn_flags. Logic is aligned with aligned with set_isa() from arch/mips/kernel/cpu-probe.c in Linux kernel. Signed-off-by:
Jiaxun Yang <jiaxun.yang@flygoat.com> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20220803103009.95972-3-jiaxun.yang@flygoat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Jiaxun Yang authored
AT_BASE_PLATFORM is a elf auxiliary vector pointing to a string to pass some architecture information. See getauxval(3) man-page. Signed-off-by:
Jiaxun Yang <jiaxun.yang@flygoat.com> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20220803103009.95972-2-jiaxun.yang@flygoat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Ilya Leoshkevich authored
Linux kernel does this in fpregs_store() and fpregs_load(), so qemu-user should do this as well. Found by running valgrind's none/tests/s390x/test_sig. Signed-off-by:
Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220817123902.585623-1-iii@linux.ibm.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Peter Maydell authored
For handling guest POSIX timers, we currently use an array g_posix_timers[], whose entries are a host timer_t value, or 0 for "this slot is unused". When the guest calls the timer_create syscall we look through the array for a slot containing 0, and use that for the new timer. This scheme assumes that host timer_t values can never be zero. This is unfortunately not a valid assumption -- for some host libc versions, timer_t values are simply indexes starting at 0. When using this kind of host libc, the effect is that the first and second timers end up sharing a slot, and so when the guest tries to operate on the first timer it changes the second timer instead. Rework the timer allocation code, so that: * the 'slot in use' indication uses a separate array from the host timer_t array * we grab the free slot atomically, to avoid races when multiple threads call timer_create simultaneously * releasing an allocated slot is abstracted out into a new free_host_timer_slot() function called in the correct places This fixes: * problems on hosts where timer_t 0 is valid * the FIXME in next_free_host_timer() about locking * bugs in the error paths in timer_create where we forgot to release the slot we grabbed, or forgot to free the host timer Reported-by:
Jon Alduan <jon.alduan@gmail.com> Signed-off-by:
Peter Maydell <peter.maydell@linaro.org> Message-Id: <20220725110035.1273441-1-peter.maydell@linaro.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
fanwenjie authored
Fixes: 66fb9763 ("basic signal handling") Fixes: cf8b8bfc ("linux-user: add support for rt_tgsigqueueinfo() system call") Signed-off-by:
fanwenjie <fanwj@mail.ustc.edu.cn> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
We don't emulate a preemptive kernel on this level, and the hppa architecture doesn't allow context switches on the gateway page. So we always have to return to sc_iaoq[] and not to gr[31]. This fixes the remaining random segfaults which still occured. Signed-off-by:
Helge Deller <deller@gmx.de> Message-Id: <20220924114501.21767-8-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
The hppa platform uses an upwards-growing stack and required in Linux kernels < 5.18 an executable stack for signal processing. For that some executables and libraries are marked to have an executable stack, for which glibc uses the mprotect() syscall to mark the stack like this: mprotect(xfa000000,4096,PROT_EXEC|PROT_READ|PROT_WRITE|PROT_GROWSUP). Currently qemu will return -TARGET_EINVAL for this syscall because of the checks in validate_prot_to_pageflags(), which doesn't allow the PROT_GROWSUP or PROT_GROWSDOWN flags and thus triggers this error in the guest: error while loading shared libraries: libc.so.6: cannot enable executable stack as shared object requires: Invalid argument Allow mprotect() to handle both flags and thus fix the guest. The glibc tst-execstack testcase can be used to reproduce the issue. Signed-off-by:
Helge Deller <deller@gmx.de> Message-Id: <20220924114501.21767-7-deller@gmx.de> [lvivier: s/elif TARGET_HPPA/elif defined(TARGET_HPPA)/] Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
The hppa target requires a much bigger stack than many other targets, and the Linux kernel allocates 80 MB by default for it. This patch increases the guest stack for hppa to 80MB, and prevents that this default stack size gets reduced by a lower stack limit on the host. Since the stack grows upwards on hppa, the stack_limit value marks the upper boundary of the stack. Fix the output of /proc/self/maps (in the guest) to show the [stack] marker on the correct memory area. Signed-off-by:
Helge Deller <deller@gmx.de> Message-Id: <20220924114501.21767-6-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
The stack-overflow check when building the "grep" debian package fails on the debian hppa target. Reason is, that the guard page at the top of the stack (which is added by qemu) prevents the fault handler in the grep program to properly detect the stack overflow. The Linux kernel on a physical machine doesn't install a guard page either, so drop it and as such fix the build of "grep". Signed-off-by:
Helge Deller <deller@gmx.de> Message-Id: <20220924114501.21767-5-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
In Linux kernel v5.18 the vDSO for signal trampoline was added. This code mimiks the bare minimum of this vDSO and thus avoids that the parisc emulation needs executable stacks. Signed-off-by:
Helge Deller <deller@gmx.de> Message-Id: <20220924114501.21767-4-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
Signed-off-by:
Helge Deller <deller@gmx.de> Message-Id: <20220924114501.21767-3-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
The xtensa platform has a value of 0x10 for PROT_SEM. Signed-off-by:
Helge Deller <deller@gmx.de> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20220924114501.21767-2-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Ilya Leoshkevich authored
This is a follow-up for commit 892a4f6a ("linux-user: Add partial support for MADV_DONTNEED"), which added passthrough for anonymous mappings. File mappings can be handled in a similar manner. In order to do that, mark pages, for which mmap() was passed through, with PAGE_PASSTHROUGH, and then allow madvise() passthrough for these pages. Drop the explicit PAGE_ANON check, since anonymous mappings are expected to have PAGE_PASSTHROUGH anyway. Add PAGE_PASSTHROUGH to PAGE_STICKY in order to keep it on mprotect(). Signed-off-by:
Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220725125043.43048-1-iii@linux.ibm.com> Message-Id: <20220906000839.1672934-5-iii@linux.ibm.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Ilya Leoshkevich authored
The default implementation has several problems: the first argument is not displayed as a pointer, making it harder to grep; the third argument is not symbolized; and there are several extra unused arguments. Signed-off-by:
Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220906000839.1672934-4-iii@linux.ibm.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Ilya Leoshkevich authored
MADV_DONTNEED has a different value on alpha, compared to all the other architectures. Fix by using TARGET_MADV_DONTNEED instead of MADV_DONTNEED. Fixes: 892a4f6a ("linux-user: Add partial support for MADV_DONTNEED") Signed-off-by:
Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220906000839.1672934-3-iii@linux.ibm.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Ilya Leoshkevich authored
Provide MADV_* definitions using target_mman.h header, similar to what kernel does. Most architectures use the same values, with the exception of alpha and hppa. Signed-off-by:
Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220906000839.1672934-2-iii@linux.ibm.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
Signed-off-by:
Helge Deller <deller@gmx.de> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20220918194555.83535-11-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
Signed-off-by:
Helge Deller <deller@gmx.de> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20220918194555.83535-10-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
On the parisc architecture the stack grows upwards. Move the TASK_UNMAPPED_BASE to high memory area as it's done by the kernel on physical machines. Signed-off-by:
Helge Deller <deller@gmx.de> Message-Id: <20220918194555.83535-9-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
If the mode parameter of chmod() is zero, this value isn't shown when stracing a program: chmod("filename",) This patch fixes it up to show the zero-value as well: chmod("filename",000) Signed-off-by:
Helge Deller <deller@gmx.de> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20220918194555.83535-8-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
Enhance the hppa linux-user cpu_loop() to show more debugging info on hard errors. Signed-off-by:
Helge Deller <deller@gmx.de> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20220918194555.83535-6-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
Enhance the EXCP_DUMP() macro to print out the failing program too. During debugging it's sometimes hard to track down the actual failing program if you are e.g. building a whole debian package. Signed-off-by:
Helge Deller <deller@gmx.de> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20220918194555.83535-5-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
I noticed those were missing when running the glib2.0 testsuite. Add the syscalls including the strace output. Signed-off-by:
Helge Deller <deller@gmx.de> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20220918194555.83535-4-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
Allow linux-user to strace the clock_gettime64() syscall. This syscall is used a lot on 32-bit guest architectures which use newer glibc versions. Signed-off-by:
Helge Deller <deller@gmx.de> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20220918194555.83535-3-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Helge Deller authored
Some of the guest signal numbers are currently not converted to their representative names in the strace output, e.g. SIGVTALRM. This patch introduces a smart way to generate and keep in sync the host-to-guest and guest-to-host signal conversion tables for usage in the qemu signal and strace code. This ensures that any signals will now show up in both tables. There is no functional change in this patch - with the exception that yet missing signal names now show up in the strace code too. Signed-off-by:
Helge Deller <deller@gmx.de> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20220918194555.83535-2-deller@gmx.de> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Sep 23, 2022
-
-
Jameson Nash authored
Exactly the same as f17f4989 before was for readlink. I suppose this was simply missed at the time. Signed-off-by:
Jameson Nash <vtjnash@gmail.com> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20220808190727.875155-1-vtjnash@gmail.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Ilya Leoshkevich authored
The new noexec test fails on s390x with "unexpected SEGV". This test overwrites code using libc's memcpy(), which uses VSTL instruction. host_signal_write() does not recognize it, which causes SEGV to be incorrectly forwarded to the test. Add all vector instructions that write to memory to host_signal_write(). Fixes: ab12c95d ("target/s390x: Make translator stop before the end of a page") Reported-by:
Thomas Huth <thuth@redhat.com> Signed-off-by:
Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20220920113907.334144-1-iii@linux.ibm.com> Tested-by:
Thomas Huth <thuth@redhat.com> Signed-off-by:
Thomas Huth <thuth@redhat.com>
-
Daniel P. Berrangé authored
The 'qemu64' CPU model implements the least featureful x86_64 CPU that's possible. Historically this hasn't been an issue since it was rare for OS distros to build with a higher mandatory CPU baseline. With RHEL-9, however, the entire distro is built for the x86_64-v2 ABI baseline: https://developers.redhat.com/blog/2021/01/05/building-red-hat-enterprise-linux-9-for-the-x86-64-v2-microarchitecture-level It is likely that other distros may take similar steps in the not too distant future. For example, it has been suggested for Fedora on a number of occasions. This new baseline is not compatible with the qemu64 CPU model though. While it is possible to pass a '-cpu xxx' flag to qemu-x86_64, the usage of QEMU doesn't always allow for this. For example, the args are typically controlled via binfmt rules that the user has no ability to change. This impacts users who are trying to use podman on aarch64 platforms, to run containers with x86_64 content. There's no arg to podman that can be used to change the qemu-x86_64 args, and a non-root user of podman can not change binfmt rules without elevating privileges: https://github.com/containers/podman/issues/15456#issuecomment-1228210973 Changing to the 'max' CPU model gives 'qemu-x86_64' maximum compatibility with binaries it is likely to encounter in the wild, and not likely to have a significant downside for existing usage. Most other architectures already use an 'any' CPU model, which is often mapped to 'max' (or similar) already, rather than the oldest possible CPU model. For the sake of consistency the 'i386' architecture is also changed from using 'qemu32' to 'max'. Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by:
Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20220923110413.70593-1-berrange@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Sep 06, 2022
-
-
Ilya Leoshkevich authored
Currently it's possible to execute pages that do not have PAGE_EXEC if there is an existing translation block. Fix by invalidating TBs that touch the affected pages. Signed-off-by:
Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20220817150506.592862-2-iii@linux.ibm.com> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org>
-
Richard Henderson authored
Map the stack executable if required by default or on demand. Acked-by:
Ilya Leoshkevich <iii@linux.ibm.com> Tested-by:
Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org>
-
Richard Henderson authored
We're about to start validating PAGE_EXEC, which means that we've got to mark the vsyscall page executable. We had been special casing this entirely within translate. Acked-by:
Ilya Leoshkevich <iii@linux.ibm.com> Tested-by:
Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org>
-