qemu/bsd-user
Ilya Leoshkevich 2b3ccf5f0d user: Introduce host_interrupt_signal
Attaching to the gdbstub of a running process requires stopping its
threads. For threads that run on a CPU, cpu_exit() is enough, but the
only way to grab attention of a thread that is stuck in a long-running
syscall is to interrupt it with a signal.

Reserve a host realtime signal for this, just like it's already done
for TARGET_SIGABRT on Linux. This may reduce the number of available
guest realtime signals by one, but this is acceptable, since there are
quite a lot of them, and it's unlikely that there are apps that need
them all.

Set signal_pending for the safe_sycall machinery to prevent invoking
the syscall. This is a lie, since we don't queue a guest signal, but
process_pending_signals() can handle the absence of pending signals.
The syscall returns with QEMU_ERESTARTSYS errno, which arranges for
the automatic restart. This is important, because it helps avoiding
disturbing poorly written guests.

Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20250117001542.8290-5-iii@linux.ibm.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20250207153112.3939799-14-alex.bennee@linaro.org>
2025-02-10 13:47:59 +00:00
..
aarch64 user: Declare cpu_loop() once in 'user/cpu_loop.h' 2024-12-20 17:44:57 +01:00
arm user: Declare cpu_loop() once in 'user/cpu_loop.h' 2024-12-20 17:44:57 +01:00
freebsd bsd-user: Simplify the implementation of execve 2024-07-23 10:50:54 -06:00
host bsd-user: Catch up with sys/param.h requirement for machine/pmap.h 2022-10-26 14:09:17 -06:00
i386 user: Declare cpu_loop() once in 'user/cpu_loop.h' 2024-12-20 17:44:57 +01:00
include user: move common-user includes to a subdirectory of {bsd,linux}-user/ 2022-01-12 14:08:29 +01:00
netbsd exec: Move [b]tswapl() declarations to 'exec/user/tswap-target.h' 2024-04-26 17:03:05 +02:00
openbsd exec: Move [b]tswapl() declarations to 'exec/user/tswap-target.h' 2024-04-26 17:03:05 +02:00
riscv user: Declare cpu_loop() once in 'user/cpu_loop.h' 2024-12-20 17:44:57 +01:00
x86_64 user: Declare cpu_loop() once in 'user/cpu_loop.h' 2024-12-20 17:44:57 +01:00
bsd-file.h {linux,bsd}-user: Introduce get_task_state() 2024-03-06 12:35:19 +00:00
bsd-mem.c bsd-user: Implement shmid_ds conversion between host and target. 2023-10-03 17:14:07 -06:00
bsd-mem.h accel/tcg: Move user-related declarations out of 'exec/cpu-all.h' (2/4) 2024-12-20 17:44:57 +01:00
bsd-proc.c bsd-user: Get number of cpus. 2023-10-03 17:14:06 -06:00
bsd-proc.h accel: Introduce AccelClass::cpu_common_[un]realize 2023-10-05 08:55:34 -04:00
bsdload.c bsd-user: TARGET_NGROUPS unused in this file, remove 2021-09-10 14:13:06 -06:00
elfcore.c bsd-user: add stubbed out core dump support 2021-09-10 14:13:06 -06:00
elfload.c hw/elf_ops: Rename elf_ops.h -> elf_ops.h.inc 2024-04-25 12:48:12 +02:00
errno_defs.h bsd-user: spelling fixes 2023-09-20 07:54:34 +03:00
main.c system: propagate Error to gdbserver_start (and other device setups) 2025-01-17 10:44:25 +00:00
meson.build configure, meson: rename targetos to host_os 2023-12-31 09:11:29 +01:00
mmap.c accel/tcg: Move user-related declarations out of 'exec/cpu-all.h' (1/4) 2024-12-20 17:44:57 +01:00
qemu-bsd.h bsd-user: Declarations for ipc_perm and shmid_ds conversion functions 2023-10-03 17:14:06 -06:00
qemu.h user: Declare cpu_loop() once in 'user/cpu_loop.h' 2024-12-20 17:44:57 +01:00
signal-common.h user: Introduce user/signal.h 2025-02-10 13:47:59 +00:00
signal.c user: Introduce host_interrupt_signal 2025-02-10 13:47:59 +00:00
strace.c exec: Move [b]tswapl() declarations to 'exec/user/tswap-target.h' 2024-04-26 17:03:05 +02:00
syscall_defs.h bsd-user: Implment madvise(2) to match the linux-user implementation. 2023-10-03 17:14:07 -06:00
trace-events trace-events: Fix the name of the tracing.rst file 2023-09-08 13:08:51 +03:00
trace.h bsd-user: Add trace events for bsd-user 2022-01-28 15:53:41 -07:00
uaccess.c bsd-user: style tweak: keyword space ( 2021-05-11 11:07:22 -06:00