#
00ed8a34 |
| 27-Sep-2022 |
Laurent Vivier <laurent@vivier.eu> |
linux-user: don't use AT_EXECFD in do_openat()
AT_EXECFD gives access to the binary file even if it is not readable (only executable).
Moreover it can be opened with flags and mode that are not the
linux-user: don't use AT_EXECFD in do_openat()
AT_EXECFD gives access to the binary file even if it is not readable (only executable).
Moreover it can be opened with flags and mode that are not the ones provided by do_openat() caller.
And it is not available because loader_exec() has closed it.
To avoid that, use only safe_openat() with the exec_path.
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20220927124357.688536-3-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
show more ...
|
#
f07eb1c4 |
| 27-Sep-2022 |
Laurent Vivier <laurent@vivier.eu> |
linux-user: handle /proc/self/exe with execve() syscall
If path is /proc/self/exe, use the executable path provided by exec_path.
Don't use execfd as it is closed by loader_exec() and otherwise wil
linux-user: handle /proc/self/exe with execve() syscall
If path is /proc/self/exe, use the executable path provided by exec_path.
Don't use execfd as it is closed by loader_exec() and otherwise will survive to the exec() syscall and be usable child process.
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20220927124357.688536-2-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
show more ...
|
#
46187d70 |
| 05-Oct-2022 |
Laurent Vivier <laurent@vivier.eu> |
linux-user: fix pidfd_send_signal()
According to pidfd_send_signal(2), info argument can be a NULL pointer. Fix strace to correctly manage ending comma in parameters.
Fixes: cc054c6f13 ("linux-user
linux-user: fix pidfd_send_signal()
According to pidfd_send_signal(2), info argument can be a NULL pointer. Fix strace to correctly manage ending comma in parameters.
Fixes: cc054c6f13 ("linux-user: Add pidfd_open(), pidfd_send_signal() and pidfd_getfd() syscalls") cc: Helge Deller <deller@gmx.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Helge Deller <deller@gmx.de> Message-Id: <20221005163826.1455313-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
show more ...
|
#
eeed2291 |
| 06-Oct-2022 |
WANG Xuerui <xen0n@gentoo.org> |
linux-user: Fix more MIPS n32 syscall ABI issues
In commit 80f0fe3a85 ("linux-user: Fix syscall parameter handling for MIPS n32") the ABI problem regarding offset64 on MIPS n32 was fixed, but still
linux-user: Fix more MIPS n32 syscall ABI issues
In commit 80f0fe3a85 ("linux-user: Fix syscall parameter handling for MIPS n32") the ABI problem regarding offset64 on MIPS n32 was fixed, but still some cases remain where the n32 is incorrectly treated as any other 32-bit ABI that passes 64-bit arguments in pairs of GPRs. Fix by excluding TARGET_ABI_MIPSN32 from various TARGET_ABI_BITS == 32 checks.
Closes: https://gitlab.com/qemu-project/qemu/-/issues/1238 Signed-off-by: WANG Xuerui <xen0n@gentoo.org> Cc: Philippe Mathieu-Daudé <f4bug@amsat.org> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com> Cc: Andreas K. Hüttel <dilfridge@gentoo.org> Cc: Joshua Kinard <kumba@gentoo.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Tested-by: Andreas K. Huettel <dilfridge@gentoo.org> Message-Id: <20221006085500.290341-1-xen0n@gentoo.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
show more ...
|
#
c72a90df |
| 28-Aug-2022 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Implement PI futexes
Define the missing FUTEX_* constants in syscall_defs.h
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.e
linux-user: Implement PI futexes
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>
show more ...
|
#
0f946731 |
| 28-Aug-2022 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Convert signal number for FUTEX_FD
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:
linux-user: Convert signal number for FUTEX_FD
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>
show more ...
|
#
a6180f8a |
| 28-Aug-2022 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Implement FUTEX_WAKE_BITSET
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20220829021006.67305-4-richard.he
linux-user: Implement FUTEX_WAKE_BITSET
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>
show more ...
|
#
57b9ccd4 |
| 28-Aug-2022 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Sink call to do_safe_futex
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 user
linux-user: Sink call to do_safe_futex
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>
show more ...
|
#
0fbc0f8d |
| 28-Aug-2022 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Combine do_futex and do_futex_time64
Pass a boolean to select between time32 and time64.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Laurent Vivier <lau
linux-user: Combine do_futex and do_futex_time64
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>
show more ...
|
#
9e59899f |
| 25-Jul-2022 |
Peter Maydell <peter.maydell@linaro.org> |
linux-user: Don't assume 0 is not a valid host timer_t value
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
linux-user: Don't assume 0 is not a valid host timer_t value
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>
show more ...
|
#
9b9145f0 |
| 30-Aug-2022 |
fanwenjie <fanwj@mail.ustc.edu.cn> |
linux-user: fix bug about missing signum convert of sigqueue
Fixes: 66fb9763af ("basic signal handling") Fixes: cf8b8bfc50 ("linux-user: add support for rt_tgsigqueueinfo() system call") Signed-off-
linux-user: fix bug about missing signum convert of sigqueue
Fixes: 66fb9763af ("basic signal handling") Fixes: cf8b8bfc50 ("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>
show more ...
|
#
0a3346b5 |
| 24-Sep-2022 |
Helge Deller <deller@gmx.de> |
linux-user/hppa: Increase guest stack size to 80MB for hppa target
The hppa target requires a much bigger stack than many other targets, and the Linux kernel allocates 80 MB by default for it.
This
linux-user/hppa: Increase guest stack size to 80MB for hppa target
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>
show more ...
|
#
cc054c6f |
| 18-Sep-2022 |
Helge Deller <deller@gmx.de> |
linux-user: Add pidfd_open(), pidfd_send_signal() and pidfd_getfd() syscalls
I noticed those were missing when running the glib2.0 testsuite. Add the syscalls including the strace output.
Signed-of
linux-user: Add pidfd_open(), pidfd_send_signal() and pidfd_getfd() syscalls
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>
show more ...
|
#
65d4830d |
| 08-Aug-2022 |
Jameson Nash <vtjnash@gmail.com> |
linux-user: fix readlinkat handling with magic exe symlink
Exactly the same as f17f4989fa193fa8279474c5462289a3cfe69aea before was for readlink. I suppose this was simply missed at the time.
Signed
linux-user: fix readlinkat handling with magic exe symlink
Exactly the same as f17f4989fa193fa8279474c5462289a3cfe69aea 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>
show more ...
|
#
976a55c0 |
| 18-Aug-2022 |
Richard Henderson <richard.henderson@linaro.org> |
Revert "linux-user: un-parent OBJECT(cpu) when closing thread"
This reverts commit 52f0c1607671293afcdb2acc2f83e9bccbfa74bb.
This caused a regression in arm/aarch64.
We are hard-coding ARMCPRegInf
Revert "linux-user: un-parent OBJECT(cpu) when closing thread"
This reverts commit 52f0c1607671293afcdb2acc2f83e9bccbfa74bb.
This caused a regression in arm/aarch64.
We are hard-coding ARMCPRegInfo pointers into TranslationBlocks, for calling into helper_{get,set}cp_reg{,64}. So we have a race condition between whichever cpu thread translates the code first (encoding the pointer), and that cpu thread exiting, so that the next execution of the TB references a freed data structure.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
#
52f0c160 |
| 11-Aug-2022 |
Alex Bennée <alex.bennee@linaro.org> |
linux-user: un-parent OBJECT(cpu) when closing thread
While forcing the CPU to unrealize by hand does trigger the clean-up code we never fully free resources because refcount never reaches zero. Thi
linux-user: un-parent OBJECT(cpu) when closing thread
While forcing the CPU to unrealize by hand does trigger the clean-up code we never fully free resources because refcount never reaches zero. This is because QOM automatically added objects without an explicit parent to /unattached/, incrementing the refcount.
Instead of manually triggering unrealization just unparent the object and let the device machinery deal with that for us.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/866 Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20220811151413.3350684-2-alex.bennee@linaro.org>
show more ...
|
#
3cd3df2a |
| 02-Aug-2022 |
Daniel P. Berrangé <berrange@redhat.com> |
linux-user: fix compat with glibc >= 2.36 sys/mount.h
The latest glibc 2.36 has extended sys/mount.h so that it defines the FSCONFIG_* enum constants. These are historically defined in linux/mount.h
linux-user: fix compat with glibc >= 2.36 sys/mount.h
The latest glibc 2.36 has extended sys/mount.h so that it defines the FSCONFIG_* enum constants. These are historically defined in linux/mount.h, and thus if you include both headers the compiler complains:
In file included from /usr/include/linux/fs.h:19, from ../linux-user/syscall.c:98: /usr/include/linux/mount.h:95:6: error: redeclaration of 'enum fsconfig_command' 95 | enum fsconfig_command { | ^~~~~~~~~~~~~~~~ In file included from ../linux-user/syscall.c:31: /usr/include/sys/mount.h:189:6: note: originally defined here 189 | enum fsconfig_command | ^~~~~~~~~~~~~~~~ /usr/include/linux/mount.h:96:9: error: redeclaration of enumerator 'FSCONFIG_SET_FLAG' 96 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ | ^~~~~~~~~~~~~~~~~ /usr/include/sys/mount.h:191:3: note: previous definition of 'FSCONFIG_SET_FLAG' with type 'enum fsconfig_command' 191 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ | ^~~~~~~~~~~~~~~~~ ...snip...
QEMU doesn't include linux/mount.h, but it does use linux/fs.h and thus gets linux/mount.h indirectly.
glibc acknowledges this problem but does not appear to be intending to fix it in the forseeable future, simply documenting it as a known incompatibility with no workaround:
https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E https://sourceware.org/glibc/wiki/Synchronizing_Headers
To address this requires either removing use of sys/mount.h or linux/fs.h, despite QEMU needing declarations from both.
This patch removes linux/fs.h, meaning we have to define various FS_IOC constants that are now unavailable.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Tested-by: Richard W.M. Jones <rjones@redhat.com> Message-Id: <20220802164134.1851910-1-berrange@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
show more ...
|
#
5b63de6b |
| 29-Jul-2022 |
Rainer Müller <raimue@codingfarm.de> |
linux-user: Use memfd for open syscall emulation
For certain paths in /proc, the open syscall is intercepted and the returned file descriptor points to a temporary file with emulated contents.
If T
linux-user: Use memfd for open syscall emulation
For certain paths in /proc, the open syscall is intercepted and the returned file descriptor points to a temporary file with emulated contents.
If TMPDIR is not accessible or writable for the current user (for example in a read-only mounted chroot or container) tools such as ps from procps may fail unexpectedly. Trying to read one of these paths such as /proc/self/stat would return an error such as ENOENT or EROFS.
To relax the requirement on a writable TMPDIR, use memfd_create() instead to create an anonymous file and return its file descriptor.
Signed-off-by: Rainer Müller <raimue@codingfarm.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220729154951.76268-1-raimue@codingfarm.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
show more ...
|
#
6f200f51 |
| 17-Jul-2022 |
Helge Deller <deller@gmx.de> |
linux-user: Use target abi_int type for pipefd[1] in pipe()
When writing back the fd[1] pipe file handle to emulated userspace memory, use sizeof(abi_int) as offset insted of the hosts's int type. T
linux-user: Use target abi_int type for pipefd[1] in pipe()
When writing back the fd[1] pipe file handle to emulated userspace memory, use sizeof(abi_int) as offset insted of the hosts's int type. There is no functional change in this patch.
Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <YtQ3Id6z8slpVr7r@p100> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
show more ...
|
#
499d8055 |
| 19-Jul-2022 |
Helge Deller <deller@gmx.de> |
linux-user: Unconditionally use pipe2() syscall
The pipe2() syscall is available on all Linux platforms since kernel 2.6.27, so use it unconditionally to emulate pipe() and pipe2().
Signed-off-by:
linux-user: Unconditionally use pipe2() syscall
The pipe2() syscall is available on all Linux platforms since kernel 2.6.27, so use it unconditionally to emulate pipe() and pipe2().
Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <YtbZ2ojisTnzxN9Y@p100> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
show more ...
|
#
24d87c18 |
| 08-Jul-2022 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user/aarch64: Implement PR_SME_GET_VL, PR_SME_SET_VL
These prctl set the Streaming SVE vector length, which may be completely different from the Normal SVE vector length.
Reviewed-by: Peter M
linux-user/aarch64: Implement PR_SME_GET_VL, PR_SME_SET_VL
These prctl set the Streaming SVE vector length, which may be completely different from the Normal SVE vector length.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20220708151540.18136-43-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
show more ...
|
#
fd72f5d0 |
| 08-Jul-2022 |
Richard Henderson <richard.henderson@linaro.org> |
linux-user: Rename sve prctls
Add "sve" to the sve prctl functions, to distinguish them from the coming "sme" prctls with similar names.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed
linux-user: Rename sve prctls
Add "sve" to the sve prctl functions, to distinguish them from the coming "sme" prctls with similar names.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20220708151540.18136-42-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
show more ...
|
#
9a7f682c |
| 28-May-2022 |
Helge Deller <deller@gmx.de> |
linux-user: Adjust child_tidptr on set_tid_address() syscall
Keep track of the new child tidptr given by a set_tid_address() syscall.
Do not call the host set_tid_address() syscall because we are e
linux-user: Adjust child_tidptr on set_tid_address() syscall
Keep track of the new child tidptr given by a set_tid_address() syscall.
Do not call the host set_tid_address() syscall because we are emulating the behaviour of writing to child_tidptr in the exit() path.
Signed-off-by: Helge Deller<deller@gmx.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <YpH+2sw1PCRqx/te@p100> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
show more ...
|
#
892a4f6a |
| 21-Jun-2022 |
Ilya Leoshkevich <iii@linux.ibm.com> |
linux-user: Add partial support for MADV_DONTNEED
Currently QEMU ignores madvise(MADV_DONTNEED), which break apps that rely on this for zeroing out memory [1]. Improve the situation by doing a passt
linux-user: Add partial support for MADV_DONTNEED
Currently QEMU ignores madvise(MADV_DONTNEED), which break apps that rely on this for zeroing out memory [1]. Improve the situation by doing a passthrough when the range in question is a host-page-aligned anonymous mapping.
This is based on the patches from Simon Hausmann [2] and Chris Fallin [3]. The structure is taken from Simon's patch. The PAGE_MAP_ANONYMOUS bits are superseded by commit 26bab757d41b ("linux-user: Introduce PAGE_ANON"). In the end the patch acts like the one from Chris: we either pass-through the entire syscall, or do nothing, since doing this only partially would not help the affected applications much. Finally, add some extra checks to match the behavior of the Linux kernel [4].
[1] https://gitlab.com/qemu-project/qemu/-/issues/326 [2] https://patchew.org/QEMU/20180827084037.25316-1-simon.hausmann@qt.io/ [3] https://github.com/bytecodealliance/wasmtime/blob/v0.37.0/ci/qemu-madvise.patch [4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/madvise.c?h=v5.19-rc3#n1368
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20220621144205.158452-1-iii@linux.ibm.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
show more ...
|
#
0effdc29 |
| 09-May-2022 |
Philippe Mathieu-Daudé <f4bug@amsat.org> |
linux-user: Remove pointless CPU{ARCH}State casts
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220509205728.51
linux-user: Remove pointless CPU{ARCH}State casts
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220509205728.51912-4-philippe.mathieu.daude@gmail.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
show more ...
|